浏览代码

* 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 年之前
父节点
当前提交
31bd38c45b
共有 1 个文件被更改,包括 11 次插入2 次删除
  1. 11 2
      compiler/psub.pas

+ 11 - 2
compiler/psub.pas

@@ -1868,8 +1868,17 @@ implementation
 
              if assigned(procdef.parentfpinitblock) then
                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;
                end;