Browse Source

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

git-svn-id: trunk@22617 -
pierre 12 years ago
parent
commit
2fdd8656d5
1 changed files with 10 additions and 1 deletions
  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 }
         { was "callee removes funcret pointer from stack" until now, we'll }
         { keep that default for everyone else (ncgcal decreases popsize by }
         { keep that default for everyone else (ncgcal decreases popsize by }
         { sizeof(aint) in case of ret_in_param())                          }
         { 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
         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));
           inc(pop_size,sizeof(aint));
 
 
         { better than an add on all processors }
         { better than an add on all processors }