Browse Source

* let inline parameter temps inherit the "const" property of const
parameters, so we don't apply reference counting to them (mantis #30323)

git-svn-id: trunk@34288 -

Jonas Maebe 9 years ago
parent
commit
70b1b32722
1 changed files with 15 additions and 1 deletions
  1. 15 1
      compiler/ncal.pas

+ 15 - 1
compiler/ncal.pas

@@ -4686,12 +4686,26 @@ implementation
             addstatement(inlinecleanupstatement,ctempdeletenode.create(tempnode));
 
             addstatement(inlineinitstatement,cassignmentnode.create(ctemprefnode.create(tempnode),
-                para.left));
+              para.left));
+
             para.left := ctemprefnode.create(tempnode);
             { inherit addr_taken flag }
             if (tabstractvarsym(para.parasym).addr_taken) then
               include(tempnode.tempinfo^.flags,ti_addr_taken);
 
+            { inherit const }
+            if tabstractvarsym(para.parasym).varspez=vs_const then
+              begin
+                include(tempnode.tempinfo^.flags,ti_const);
+
+                { apply less strict rules for the temp. to be a register than
+                  ttempcreatenode does
+
+                  this way, dyn. array, ansistrings etc. can be put into registers as well }
+                if tparavarsym(para.parasym).is_regvar(false) then
+                  include(tempnode.tempinfo^.flags,ti_may_be_in_reg);
+              end;
+
             result:=true;
           end
       end;