This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/19058] New: setjmp: 4.0 fails to give 'clobbered' warning (regression from 3.4.1)
- From: "bh at techhouse dot brown dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Dec 2004 16:03:39 -0000
- Subject: [Bug c/19058] New: setjmp: 4.0 fails to give 'clobbered' warning (regression from 3.4.1)
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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