This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/53917] Warning message line about variable points to place where variable doesn't occur
- From: "Paulo.Matos at csr dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 10 Jul 2012 16:37:20 +0000
- Subject: [Bug middle-end/53917] Warning message line about variable points to place where variable doesn't occur
- Auto-submitted: auto-generated
- References: <bug-53917-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53917
--- Comment #1 from Paulo J. Matos <Paulo.Matos at csr dot com> 2012-07-10 16:37:20 UTC ---
Here's another example:
void fn1 ();
typedef struct
{
int hdr[0];
} foo;
typedef enum
{
READ_WRITE
} bar;
typedef struct
{
struct
{
foo t1;
} mp;
} foobar;
bar fn2 ();
typedef struct
{
foobar tag_mem_config;
} tag;
static int
fn3 (foobar * p1)
{
int valid;
if (p1->mp.t1.hdr[0])
valid = 0;
else
switch (fn2 ())
case 0:
valid = 1;
return valid;
}
void
fn4 ()
{
tag p_t1_rw_fsm_data;
if (fn3 (&p_t1_rw_fsm_data.tag_mem_config))
fn1 ();
}
GCC says:
test.c: In function 'fn4':
test.c:38:8: warning: 'valid' may be used uninitialized in this function
[-Wuninitialized]
Again, line 38 is: if (fn3 (&p_t1_rw_fsm_data.tag_mem_config))
In this case this looks like it's related to inlining.