Kaynağa Gözat

* only add the procdef's parentfpinitblock if there are any statements in it
* internalerror if we try to add a non-empty parentfpinitblock to a
pure assembler routine

git-svn-id: trunk@32740 -

Jonas Maebe 9 yıl önce
ebeveyn
işleme
31bd38c45b
1 değiştirilmiş dosya ile 11 ekleme ve 2 silme
  1. 11 2
      compiler/psub.pas

+ 11 - 2
compiler/psub.pas

@@ -1868,8 +1868,17 @@ implementation
 
 
              if assigned(procdef.parentfpinitblock) then
              if assigned(procdef.parentfpinitblock) then
                begin
                begin
-                 tblocknode(code).left:=cstatementnode.create(procdef.parentfpinitblock,tblocknode(code).left);
-                 do_typecheckpass(tblocknode(code).left);
+                 if assigned(tblocknode(procdef.parentfpinitblock).left) then
+                   begin
+                     { could be an asmn in case of a pure assembler procedure,
+                       but those shouldn't access nested variables }
+                     if code.nodetype<>blockn then
+                       internalerror(2015122601);
+                     tblocknode(code).left:=cstatementnode.create(procdef.parentfpinitblock,tblocknode(code).left);
+                     do_typecheckpass(tblocknode(code).left);
+                   end
+                 else
+                   procdef.parentfpinitblock.free;
                  procdef.parentfpinitblock:=nil;
                  procdef.parentfpinitblock:=nil;
                end;
                end;