https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48483
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Known to work| |10.2.0, 11.0, 5.1.0 Status|NEW |RESOLVED Component|c++ |tree-optimization Resolution|--- |FIXED CC| |msebor at gcc dot gnu.org --- Comment #22 from Martin Sebor <msebor at gcc dot gnu.org> --- GCC diagnoses the test case in comment #0 at -O0 (one warning) as well as above (two warnings) since r209443: pr48483.C: In function ‘int main()’: pr48483.C:12:22: warning: ‘a.A::b’ is used uninitialized [-Wuninitialized] 12 | A a(a.b); | ^ pr48483.C:12:17: note: ‘a’ declared here 12 | A a(a.b); | ^ With -O1 and higher it also diagnoses the test case in comment #2: In member function ‘int A::TheInt()’, inlined from ‘int main()’ at pr48483-c2.C:11:16: pr48483-c2.C:6:33: warning: ‘a.A::a’ is used uninitialized [-Wuninitialized] 6 | int TheInt(){return a;} | ^ pr48483-c2.C: In function ‘int main()’: pr48483-c2.C:11:17: note: ‘a’ declared here 11 | A a(a.TheInt()); | ^ At -O0 and above it also diagnoses the test case in comment #3 (also since r209443) pr48483-c3.C:5:12: warning: ‘s.main()::S::a’ is used uninitialized [-Wuninitialized] 5 | return s.a; | ^ pr48483-c3.C:4:23: note: ‘s’ declared here 4 | struct S { int a; } s; | ^ The test case in comment #16 isn't diagnosed but that one is sufficiently different that I think it should be tracked separately (if it isn't yet; I suspect there probably is a duplicate somewhere but if not I'll add one). With that, let me add the passing test cases and resolve this as fixed.