public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/19058] New: setjmp: 4.0 fails to give 'clobbered' warning (regression from 3.4.1)
@ 2004-12-17 16:03 bh at techhouse dot brown dot edu
  2004-12-17 16:18 ` [Bug c/19058] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: bh at techhouse dot brown dot edu @ 2004-12-17 16:03 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-02-02  7:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-17 16:03 [Bug c/19058] New: setjmp: 4.0 fails to give 'clobbered' warning (regression from 3.4.1) bh at techhouse dot brown dot edu
2004-12-17 16:18 ` [Bug c/19058] " pinskia at gcc dot gnu dot org
2004-12-20  0:56 ` [Bug tree-optimization/19058] " pinskia at gcc dot gnu dot org
2004-12-20  0:56 ` [Bug tree-optimization/19058] [4.0 Regression] " pinskia at gcc dot gnu dot org
2005-01-15  8:25 ` pinskia at gcc dot gnu dot org
2005-01-18  0:43 ` pinskia at gcc dot gnu dot org
2005-02-02  7:13 ` rth at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).