In the code that follows, gcc-3.4.1 says: > gcc -W -Wall -Wno-unused-parameter qux.c -O2 qux.c:13: warning: variable 'x' might be clobbered by `longjmp' or `vfork'
gcc-4.0 with those same options gives no warning. Note that neither version warns about 'sum' being clobbered. #include <signal.h> #include <setjmp.h> #include <stdio.h> static jmp_buf jmpbuf; static void segv_handler(int sig) { longjmp(jmpbuf, 1); } int main() { int y = 1; volatile int *x = &y; int sum = 0; signal(SIGSEGV, segv_handler); if(setjmp(jmpbuf) == 0) { while(1) { sum += *x; x++; } } printf("%d\n", sum); return sum; } -- Summary: setjmp: 4.0 fails to give 'clobbered' warning (regression from 3.4.1) Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: bh at techhouse dot brown dot edu CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19058