Browse Source

* CallRet2* optimization may not misalign the stack, reported by C Western on fpc-devel

git-svn-id: trunk@44253 -
florian 5 years ago
parent
commit
34be9e4643
1 changed files with 4 additions and 1 deletions
  1. 4 1
      compiler/x86/aoptx86.pas

+ 4 - 1
compiler/x86/aoptx86.pas

@@ -176,6 +176,7 @@ unit aoptx86;
 
 
     uses
     uses
       cutils,verbose,
       cutils,verbose,
+      systems,
       globals,
       globals,
       cpuinfo,
       cpuinfo,
       procinfo,
       procinfo,
@@ -5902,7 +5903,9 @@ unit aoptx86;
           MatchInstruction(hp1,A_RET,[S_NO]) and
           MatchInstruction(hp1,A_RET,[S_NO]) and
           (taicpu(hp1).ops=0) then
           (taicpu(hp1).ops=0) then
           begin
           begin
-            if cs_opt_level4 in current_settings.optimizerswitches then
+            if (cs_opt_level4 in current_settings.optimizerswitches) and
+              { we might destroy stack alignment here if we do not do a call }
+              (target_info.stackalign<=sizeof(SizeUInt)) then
               begin
               begin
                 taicpu(p).opcode := A_JMP;
                 taicpu(p).opcode := A_JMP;
                 taicpu(p).is_jmp := true;
                 taicpu(p).is_jmp := true;