public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/17191] New: address taken prevents uninitialized variable warning
@ 2004-08-25 21:13 nomura at netapp dot com
  2004-08-25 21:16 ` [Bug c/17191] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: nomura at netapp dot com @ 2004-08-25 21:13 UTC (permalink / raw)
  To: gcc-bugs

Compiling this code with -O -Wall should warn that "i" is used without
being initialized.  The presence of "p = &i" stops this warning
from being issued, but the address is not exposed in a way that could
affect i.  (No path from the address taken to the use, and the variable 
is local).  If the uninit warning could be strengthened it would have
real benefits.

-- Source code:

int *p;

void foo ()
{
        int i;
        if (i < 100)
                return;
        p = &i;
}

-- Command line:

[gecko]$ xgcc-3.4 -v -c -O2 a.c -Wall -Werror
Reading specs from /u/nomura/dl/gcc-3.4.1_linux/gcc/specs
Configured with: ../gcc-3.4.1/configure --enable-languages=c,c++
--prefix=/x/sim/nomura/root.linux/gcc-3.4.1
Thread model: posix
gcc version 3.4.1
 /u/nomura/dl/gcc-3.4.1_linux/gcc/cc1 -quiet -v -iprefix
/u/nomura/dl/gcc-3.4.1_linux/gcc/../lib/gcc/i686-pc-linux-gnu/3.4.1/ -isystem
/u/nomura/dl/gcc-3.4.1_linux/gcc/include a.c -quiet -dumpbase a.c
-mtune=pentiumpro -auxbase a -O2 -Wall -Werror -version -o /tmp/ccN7EB39.s
ignoring nonexistent directory
"/u/nomura/dl/gcc-3.4.1_linux/gcc/../lib/gcc/i686-pc-linux-gnu/3.4.1/include"
ignoring nonexistent directory
"/u/nomura/dl/gcc-3.4.1_linux/gcc/../lib/gcc/i686-pc-linux-gnu/3.4.1/../../../../i686-pc-linux-gnu/include"
ignoring nonexistent directory
"/x/sim/nomura/root.linux/gcc-3.4.1/lib/gcc/i686-pc-linux-gnu/3.4.1/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /u/nomura/dl/gcc-3.4.1_linux/gcc/include
 /usr/local/include
 /x/sim/nomura/root.linux/gcc-3.4.1/include
 /x/sim/nomura/root.linux/gcc-3.4.1/lib/gcc/i686-pc-linux-gnu/3.4.1/include
 /usr/include
End of search list.
GNU C version 3.4.1 (i686-pc-linux-gnu)
        compiled by GNU C version 3.2 20020903 (Red Hat Linux 8.0 3.2-7).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
 /x/sim/nomura/root.linux/gcc-3.4.1/lib/gcc/i686-pc-linux-gnu/3.4.1/../../../../i686-pc-linux-gnu/bin/as
--traditional-format -V -Qy -o a.o /tmp/ccN7EB39.s
GNU assembler version 2.15 (i686-pc-linux-gnu) using BFD version 2.15
[gecko]$

-- 
           Summary: address taken prevents uninitialized variable warning
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: nomura at netapp dot com
                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=17191


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

* [Bug c/17191] address taken prevents uninitialized variable warning
  2004-08-25 21:13 [Bug c/17191] New: address taken prevents uninitialized variable warning nomura at netapp dot com
@ 2004-08-25 21:16 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-25 21:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-25 21:16 -------


*** This bug has been marked as a duplicate of 179 ***

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


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


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

end of thread, other threads:[~2004-08-25 21:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-25 21:13 [Bug c/17191] New: address taken prevents uninitialized variable warning nomura at netapp dot com
2004-08-25 21:16 ` [Bug c/17191] " pinskia 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).