Bug 23805 - No warning for uninitialized variable.
Summary: No warning for uninitialized variable.
Status: RESOLVED DUPLICATE of bug 19430
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.0.1
: P2 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
Keywords: diagnostic
Depends on:
Reported: 2005-09-10 02:00 UTC by Mike McCormack
Modified: 2005-09-10 02:16 UTC (History)
1 user (show)

See Also:
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 Mike McCormack 2005-09-10 02:00:33 UTC
Comment 1 Mike McCormack 2005-09-10 02:04:33 UTC

char *foo(char **x) { if(*x) return x[0]; return 0; }
char *bar(void) { char *x, *y = 0; if(x) y = foo(&x); return y; }

/usr/local/gcc-4.0.1/bin/gcc -Wall -O2 -Wuninitialized -c tg.c

Give no warnings at all, even though x is used without initialization.

bash-3.00$ /usr/local/gcc-4.0.1/bin/gcc -v                                
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.0.1/configure --prefix=/usr/local/gcc-4.0.1
Thread model: posix
gcc version 4.0.1

bash-3.00$ uname -a
Linux black 2.6.13 #4 Mon Aug 29 12:35:27 KST 2005 i686 unknown unknown GNU/Linux

Slackware current, built gcc 4.0 myself to check gcc 4.0 warnings in Wine.
Comment 2 Andrew Pinski 2005-09-10 02:16:24 UTC
Not this is hard to get right.

Anyways, this is a dup of bug 19430.

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