Bug 42238 - Missing warning about uninitialized variable
Summary: Missing warning about uninitialized variable
Status: RESOLVED DUPLICATE of bug 34772
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-01 11:46 UTC by David Sveningsson
Modified: 2009-12-30 11:29 UTC (History)
7 users (show)

See Also:
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Build: x86_64-pc-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 David Sveningsson 2009-12-01 11:46:31 UTC
When compiling the following code I expect a warning about usage of uninitialized variable.

int main(int argc, const char*[]){
        do {
                int a = a;
        } while(1);

        return 0;
}

Even when compiled with "-Wall -Winit-self" I get no warning. I have tried with both g++-4.4.2 and g++-4.2.4 with the same result.

This is a simplification of the case I posted on the gcc-help list (http://gcc.gnu.org/ml/gcc-help/2009-11/msg00250.html).
Comment 1 Andrew Pinski 2009-12-01 19:31:54 UTC
<bb 2>:
  # a_1 = PHI <a_2(D)(0), a_3(2)>
  a_3 = a_1;
  goto <bb 2>;
Comment 2 Manuel López-Ibáñez 2009-12-30 11:29:31 UTC
-Winit-self is broken in C++

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