Bug 46226 - asm goto may leave stack pointer invalid
Summary: asm goto may leave stack pointer invalid
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 4.5.1
: P2 normal
Target Milestone: 4.5.2
Assignee: Richard Henderson
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2010-10-29 15:55 UTC by Richard Henderson
Modified: 2010-10-29 17:16 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-10-29 15:58:07


Attachments
Failing test case (243 bytes, text/plain)
2010-10-29 15:55 UTC, Richard Henderson
Details

Note You need to log in before you can comment on or make changes to this bug.
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