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] New: Warning message line about variable points to place where variable doesn't occur


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

             Bug #: 53917
           Summary: Warning message line about variable points to place
                    where variable doesn't occur
    Classification: Unclassified
           Product: gcc
           Version: 4.6.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: Paulo.Matos@csr.com


Created attachment 27771
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27771
Testcase

Hi,

I have noticed that when compiling the following test case (will attach to the
bug):

test1.c:
int a, b;
void fn1 ();
typedef enum
{
    READ_WRITE
} TAG_STATE;
TAG_STATE fn2 ();
void
fn3 ()
{
    int c;
    if (a)
        c = 0;
    else
        switch (fn2 ())
        case 0:
    c = 1;
    b = c;
    if (b)
        fn1 ();
}

gcc says:
$  gcc -Os -S -Wall test1.c
test1.c: In function 'fn3':
test1.c:19:8: warning: 'c' may be used uninitialized in this function
[-Wuninitialized]

However line 19 is 'if (b)'.

Used gcc46 but also reproducible with gcc47.


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