Following emits a warning about potential use of uninitialized variable,
even though the variable initialization and it's use are guarded by the
same predicate.

int f (void);

int g (int a)
{
    int b;

    if (a) b = f ();
    asm volatile ("#");
    if (a) return b;
    return 1;
}

$ gcc -O -Wuninitialized -c repro.c                
repro.c: In function 'g':
repro.c:5: warning: 'b' may be used uninitialized in this function

This happens with gcc 4.3.0 and 4.3.1


-- 
           Summary: Warning about potential use of uninitialized variable
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: av1474 at comtv dot ru
 GCC build triplet: powerpc-unknown-linux-gnu
  GCC host triplet: powerpc-unknown-linux-gnu
GCC target triplet: powerpc-unknown-linux-gnu


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

Reply via email to