Red Hat Bugzilla – Bug 139929
Invalid code generated for __builtin_setjmp with -fomit-frame-pointer
Last modified: 2007-11-30 17:10:55 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5)
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):
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.
Created attachment 106985 [details]
This is the test case for the bug.
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.
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. defaulted to -mtune=i686 or something else.
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?
I believe http://gcc.gnu.org/ml/gcc-patches/2004-10/msg01562.html
should fix it, just need to verify that.
Should be fixed in gcc-3.4.3-4 in rawhide.