This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/53917] Warning message line about variable points to place where variable doesn't occur


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]