https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91225
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic Status|UNCONFIRMED |NEW Last reconfirmed| |2019-07-22 CC| |msebor at gcc dot gnu.org See Also| |https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=52167 Ever confirmed|0 |1 --- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> --- Clang has diagnosed the following with -Wuninitialized (included in -Wall) since at least version 3.0: int foo(void) { int a = a; return a; } GCC requires -Winit-self to diagnose this bug. Neither diagnoses the test case in comment #0 (the initialization is eliminated and the variable is unused). I suppose this could be viewed as a duplicate of pr52167 but that request (and all its duplicates) is specific to C++ and classes with ctors where the fix I suspect is substantially more involved than just flipping -Winit-self on. With that I think it makes sense to treat this as separate. Confirmed.