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

* [Bug c/19058] setjmp: 4.0 fails to give 'clobbered' warning (regression from 3.4.1)
  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 ` pinskia at gcc dot gnu dot org
  2004-12-20  0:56 ` [Bug tree-optimization/19058] " pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-17 16:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-17 16:18 -------
This is because sum is not used outside of the loop with optimization turned on.  We always use 0.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19058


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

* [Bug tree-optimization/19058] [4.0 Regression] setjmp: 4.0 fails to give 'clobbered' warning (regression from 3.4.1)
  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 ` pinskia at gcc dot gnu dot org
  2005-01-15  8:25 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-20  0:56 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|setjmp: 4.0 fails to give   |[4.0 Regression] setjmp: 4.0
                   |'clobbered' warning         |fails to give 'clobbered'
                   |(regression from 3.4.1)     |warning (regression from
                   |                            |3.4.1)
   Target Milestone|---                         |4.0.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19058


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

* [Bug tree-optimization/19058] setjmp: 4.0 fails to give 'clobbered' warning (regression from 3.4.1)
  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 ` 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
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-20  0:56 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |tree-optimization
           Keywords|                            |diagnostic


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19058


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

* [Bug tree-optimization/19058] [4.0 Regression] setjmp: 4.0 fails to give 'clobbered' warning (regression from 3.4.1)
  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
                   ` (2 preceding siblings ...)
  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
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-15  8:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-15 08:24 -------
Hmm, The only thing I can think of is moving this warning to the tree level before we do any 
optimization.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19058


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

* [Bug tree-optimization/19058] [4.0 Regression] setjmp: 4.0 fails to give 'clobbered' warning (regression from 3.4.1)
  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
                   ` (3 preceding siblings ...)
  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
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-18  0:43 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia 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

* [Bug tree-optimization/19058] [4.0 Regression] setjmp: 4.0 fails to give 'clobbered' warning (regression from 3.4.1)
  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
                   ` (4 preceding siblings ...)
  2005-01-18  0:43 ` pinskia at gcc dot gnu dot org
@ 2005-02-02  7:13 ` rth at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: rth at gcc dot gnu dot org @ 2005-02-02  7:13 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rth at gcc dot gnu dot org  2005-02-02 07:12 -------
The warning has *always* been specifically dependant on which registers are
assigned to which decls.  So it was never assured that you'd get the warning
when you actually needed it.

In this case you're doubly screwed because you expect gcc to magically follow
the path from "*x" through the signal handler, through to setjmp.  Well, we're
not going to do that.

INVALID or WONTFIX, your choice.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |WONTFIX


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).