Browse Source

* cs_generate_stackframes (w+/-) should only apply to normal routines,
not to pure assembler routines

git-svn-id: trunk@6159 -

Jonas Maebe 18 years ago
parent
commit
1218322f8c
2 changed files with 4 additions and 6 deletions
  1. 1 2
      compiler/psub.pas
  2. 3 4
      tests/webtbs/tw6687.pp

+ 1 - 2
compiler/psub.pas

@@ -776,7 +776,6 @@ implementation
              or
              or
               - Delphi mode
               - Delphi mode
               - assembler directive
               - assembler directive
-              - no cs_generate_stackframes in localswitches
               - no pushes are used/esp modifications, could be:
               - no pushes are used/esp modifications, could be:
                 * outgoing parameters on the stack
                 * outgoing parameters on the stack
                 * incoming parameters on the stack
                 * incoming parameters on the stack
@@ -784,10 +783,10 @@ implementation
               - no local variables
               - no local variables
             }
             }
             if ((po_assembler in procdef.procoptions) and
             if ((po_assembler in procdef.procoptions) and
-                not(cs_generate_stackframes in current_settings.localswitches) and
                 (m_delphi in current_settings.modeswitches) and
                 (m_delphi in current_settings.modeswitches) and
                 (tabstractlocalsymtable(procdef.localst).count_locals = 0)) or
                 (tabstractlocalsymtable(procdef.localst).count_locals = 0)) or
                ((cs_opt_stackframe in current_settings.optimizerswitches) and
                ((cs_opt_stackframe in current_settings.optimizerswitches) and
+                not(cs_generate_stackframes in current_settings.localswitches) and
                 not(po_assembler in procdef.procoptions) and
                 not(po_assembler in procdef.procoptions) and
                 ((flags*[pi_has_assembler_block,pi_uses_exceptions,pi_is_assembler,
                 ((flags*[pi_has_assembler_block,pi_uses_exceptions,pi_is_assembler,
                         pi_needs_implicit_finally,pi_has_implicit_finally,pi_has_stackparameter,
                         pi_needs_implicit_finally,pi_has_implicit_finally,pi_has_stackparameter,

+ 3 - 4
tests/webtbs/tw6687.pp

@@ -1,17 +1,16 @@
 { %cpu=i386 }
 { %cpu=i386 }
 { %target=win32,linux,freebsd }
 { %target=win32,linux,freebsd }
 
 
-{$w+}
-
 {$ifdef fpc}
 {$ifdef fpc}
 {$mode delphi}
 {$mode delphi}
 {$endif}
 {$endif}
 
 
-{ should generate a stack frame because of w+ above }
+{$w+}
+
+{ should not generate a stack frame in spite of w+ above }
 function testje(l1,l2,l3: longint): longint;
 function testje(l1,l2,l3: longint): longint;
 asm
 asm
   mov eax, 30000
   mov eax, 30000
-  leave
   ret
   ret
 end;
 end;