The warning below is inappropriate since j can never be used in the function.

$ cat t.cpp && gcc -c -O -W t.cpp
int foo ()
{
    int i;
    int j;

    for ( ; ; ) {
        i = 0;
        if (0 == i)
            break;
    }

    if (1 == i)
        return j;

    return 0;
}

t.cpp: In function `int foo()':
t.cpp:4: warning: 'j' might be used uninitialized in this function

-- 
           Summary: bogus uninitialized warning on unused variable
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sebor at roguewave dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: all
  GCC host triplet: all
GCC target triplet: all


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

Reply via email to