Bug 139929 - Invalid code generated for __builtin_setjmp with -fomit-frame-pointer
Invalid code generated for __builtin_setjmp with -fomit-frame-pointer
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Depends On:
  Show dependency treegraph
Reported: 2004-11-18 15:10 EST by Tom Hughes
Modified: 2007-11-30 17:10 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-11-22 05:48:46 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Test case (977 bytes, text/plain)
2004-11-18 15:10 EST, Tom Hughes
no flags Details

  None (edit)
Description Tom Hughes 2004-11-18 15:10:00 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5)
Gecko/20041111 Firefox/1.0

Description of problem:
When -fomit-frame-pointer is used with
__builtin_setjmp/__builtin_longjmp incorrect code is sometimes
produces that causes the stack pointer to be positioned wrongly after
a jump is taken.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
Compile the attached code with the following command:

  cc -Wall -O -g -fomit-frame-pointer -o setjmp setjmp.c

Run the code and notice that the address of the local variables
changes after the longjmp is taken. It then crashes.

Additional info:
Comment 1 Tom Hughes 2004-11-18 15:10:41 EST
Created attachment 106985 [details]
Test case

This is the test case for the bug.
Comment 2 Tom Hughes 2004-11-18 15:11:25 EST
One other thing - I've tried this with clean 3.4.2 and 3.4.3 builds
from the gcc.gnu.org source and neither of those fails in this way.
Comment 3 Jakub Jelinek 2004-11-18 15:45:03 EST
Well, I can certainly reproduce it with stock 3.4 branch (both mid October
and         .ident  "GCC: (GNU) 3.4.4 20041118 (prerelease)").
The important options for reproduction are -O -fomit-frame-pointer -m32 -march=i386
Maybe your self built gcc 3.4.[23] defaulted to -mtune=i686 or something else.
Comment 4 Tom Hughes 2004-11-18 15:58:14 EST
Must have done - all I did was run configure with no arguments. I just
tried 3.4.3 with -mtune=i386 and that fails. Will you punt this
upstream or should I report this on the gcc tracker?
Comment 5 Jakub Jelinek 2004-11-18 16:00:30 EST
I believe http://gcc.gnu.org/ml/gcc-patches/2004-10/msg01562.html
should fix it, just need to verify that.
Comment 6 Jakub Jelinek 2004-11-22 05:48:46 EST
Should be fixed in gcc-3.4.3-4 in rawhide.

Note You need to log in before you can comment on or make changes to this bug.