Răsfoiți Sursa

* don't create a temp. for a dereferenced pointer which is passed to a var parameter of an inline procedure

git-svn-id: trunk@20478 -
florian 13 ani în urmă
părinte
comite
a7b46fc36f
1 a modificat fișierele cu 5 adăugiri și 2 ștergeri
  1. 5 2
      compiler/ncal.pas

+ 5 - 2
compiler/ncal.pas

@@ -3699,8 +3699,11 @@ implementation
                 { otherwise if the parameter is "complex", take the address   }
                 { of the parameter expression, store it in a temp and replace }
                 { occurrences of the parameter with dereferencings of this    }
-                { temp                                                        }
-                else if (paracomplexity > 1) then
+                { temp                                    }
+                else
+                  { don't create a temp. for the often seen case that p^ is passed to a var parameter }
+                  if (paracomplexity>2) or
+                    ((paracomplexity>1) and not((para.left.nodetype=derefn) and (para.parasym.varspez = vs_var))) then
                   begin
                     ptrtype:=tpointerdef.create(para.left.resultdef);
                     tempnode := ctempcreatenode.create(ptrtype,ptrtype.size,tt_persistent,tparavarsym(para.parasym).is_regvar(true));