Bug 39088 - Warning about potential use of uninitialized variable
Summary: Warning about potential use of uninitialized variable
Status: RESOLVED DUPLICATE of bug 36550
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-03 15:54 UTC by av1474
Modified: 2009-02-04 00:09 UTC (History)
4 users (show)

See Also:
Host: powerpc-unknown-linux-gnu
Target: powerpc-unknown-linux-gnu
Build: powerpc-unknown-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description av1474 2009-02-03 15:54:16 UTC
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
Comment 1 Andrew Pinski 2009-02-04 00:09:08 UTC

*** This bug has been marked as a duplicate of 36550 ***