Browse Source

* Fixed expectloc of local variables passed as a formal parameter. This issue is caught by cycling the compiler with -dEXTDEBUG. Yet the compiler can't cycle with EXTDEBUG due to other issues with wrong expectloc.

git-svn-id: trunk@48650 -
yury 4 years ago
parent
commit
4245b20a32
1 changed files with 10 additions and 0 deletions
  1. 10 0
      compiler/ncal.pas

+ 10 - 0
compiler/ncal.pas

@@ -1392,6 +1392,16 @@ implementation
                         else
                         else
                           make_not_regable(left,[ra_addr_regable])
                           make_not_regable(left,[ra_addr_regable])
                       end;
                       end;
+                    vs_const:
+                      if parasym.vardef.typ=formaldef then
+                        begin
+                          { compilerprocs never capture the address of their
+                            parameters }
+                          if not(po_compilerproc in aktcallnode.procdefinition.procoptions) then
+                            make_not_regable(left,[ra_addr_regable,ra_addr_taken])
+                          else
+                            make_not_regable(left,[ra_addr_regable])
+                        end;
                     else
                     else
                       set_varstate(left,vs_read,[vsf_must_be_valid]);
                       set_varstate(left,vs_read,[vsf_must_be_valid]);
                   end;
                   end;