Bug 46226

Summary: asm goto may leave stack pointer invalid
Product: gcc Reporter: Richard Henderson <rth>
Component: rtl-optimizationAssignee: Richard Henderson <rth>
Status: RESOLVED FIXED    
Severity: normal CC: jakub
Priority: P2 Keywords: wrong-code
Version: 4.5.1   
Target Milestone: 4.5.2   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2010-10-29 15:58:07
Attachments: Failing test case

Description Richard Henderson 2010-10-29 15:55:24 UTC
Created attachment 22199 [details]
Failing test case

The following test case shows how do_pending_stack_adjust is
not properly called before the new kind of control flow insn
is emitted.
Comment 1 Richard Henderson 2010-10-29 15:58:07 UTC
Forgot to mention the compilation flags:

gcc -m32 --save-temps -Os -march=i486 -fomit-frame-pointer z.c
Comment 2 Richard Henderson 2010-10-29 16:56:26 UTC
Author: rth
Date: Fri Oct 29 16:56:18 2010
New Revision: 166067

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=166067
Log:
PR rtl-opt/46226
* stmt.c (expand_asm_operands): Call do_pending_stack_adjust
for asm goto.

Added:
    trunk/gcc/testsuite/gcc.dg/pr46226.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/stmt.c
Comment 3 Richard Henderson 2010-10-29 16:58:43 UTC
Author: rth
Date: Fri Oct 29 16:58:36 2010
New Revision: 166068

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=166068
Log:
PR rtl-opt/46226
* stmt.c (expand_asm_operands): Call do_pending_stack_adjust
for asm goto.

Added:
    branches/gcc-4_5-branch/gcc/testsuite/gcc.dg/pr46226.c
Modified:
    branches/gcc-4_5-branch/gcc/ChangeLog
    branches/gcc-4_5-branch/gcc/stmt.c
Comment 4 Richard Henderson 2010-10-29 17:04:51 UTC
Fixed.

Jakub, I know that you've back-ported asm-goto to several
redhat branches, but I don't recall which ones.  Obviously
the patch will need inclusion there too.
Comment 5 Richard Henderson 2010-10-29 17:12:51 UTC
Author: rth
Date: Fri Oct 29 17:12:46 2010
New Revision: 166069

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=166069
Log:
PR rtl-opt/46226
Move test case to x86 test directory.

Added:
    trunk/gcc/testsuite/gcc.target/i386/pr46226.c
      - copied, changed from r166067, trunk/gcc/testsuite/gcc.dg/pr46226.c
Removed:
    trunk/gcc/testsuite/gcc.dg/pr46226.c
Comment 6 Richard Henderson 2010-10-29 17:16:16 UTC
Author: rth
Date: Fri Oct 29 17:16:11 2010
New Revision: 166070

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=166070
Log:
PR rtl-opt/46226
Move test case to x86 test directory.

Added:
    branches/gcc-4_5-branch/gcc/testsuite/gcc.target/i386/pr46226.c
      - copied, changed from r166068, branches/gcc-4_5-branch/gcc/testsuite/gcc.dg/pr46226.c
Removed:
    branches/gcc-4_5-branch/gcc/testsuite/gcc.dg/pr46226.c