User account creation filtered due to spam.

Bug 17191 - address taken prevents uninitialized variable warning
Summary: address taken prevents uninitialized variable warning
Status: RESOLVED DUPLICATE of bug 179
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 3.4.1
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2004-08-25 21:13 UTC by nomura
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description nomura 2004-08-25 21:13:25 UTC
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)
        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++
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
ignoring nonexistent directory
ignoring nonexistent directory
#include "..." search starts here:
#include <...> search starts here:
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
--traditional-format -V -Qy -o a.o /tmp/ccN7EB39.s
GNU assembler version 2.15 (i686-pc-linux-gnu) using BFD version 2.15
Comment 1 Andrew Pinski 2004-08-25 21:16:17 UTC

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