瀏覽代碼

* Fix tw18702.pp i386-win32 specific failure (stack was not properly maintained)

git-svn-id: trunk@22617 -
pierre 12 年之前
父節點
當前提交
2fdd8656d5
共有 1 個文件被更改,包括 10 次插入1 次删除
  1. 10 1
      compiler/i386/n386cal.pas

+ 10 - 1
compiler/i386/n386cal.pas

@@ -87,8 +87,17 @@ implementation
         { was "callee removes funcret pointer from stack" until now, we'll }
         { keep that default for everyone else (ncgcal decreases popsize by }
         { sizeof(aint) in case of ret_in_param())                          }
+        { This is only correct if the hidden funcret parameter
+          is not passed as a register.
+          As it is inserted in parast after all other hidden parameters,
+          it is always the first parameter (apart from hidden parentfp,
+          but this one is never put into a register (vs_nonregable set)
+          so funcret is always in EAX for register calling }
         if (target_info.system = system_i386_win32) and
-            paramanager.ret_in_param(procdefinition.returndef,procdefinition.proccalloption) then
+            paramanager.ret_in_param(procdefinition.returndef,procdefinition.proccalloption) and
+            not ((procdefinition.proccalloption=pocall_register) or
+                 ((procdefinition.proccalloption=pocall_internproc) and
+                  (pocall_default=pocall_register))) then
           inc(pop_size,sizeof(aint));
 
         { better than an add on all processors }