https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81809
Bug ID: 81809 Summary: missing -Wuninitialized due to alias analysis limitation Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: msebor at gcc dot gnu.org Target Milestone: --- This almost certainly a side-effect of the limitations of the flow-insensitive alias analysis pointed out in bug 23384 but I wanted to make a record of the impact the limitation has beyond optimization. Both functions below read the uninitialized variable b. The uninitialized read is diagnosed in g() but not in h() because the address of the variable is considered to have escaped even though it doesn't happen until after it has been read. $ cat a.c && gcc -O2 -S -Wall -Wextra -Wpedantic a.c void f (const void*); int g (void) { int a, b; f (&a); int i = b; // -Wuninitialized (good) return i; } int h (void) { int a, b; f (&a); int i = b; // missing -Wuninitialized (bug) f (&b); // &b escapes here return i; } a.c: In function ‘g’: a.c:8:7: warning: ‘b’ is used uninitialized in this function [-Wuninitialized] int i = b; // -Wuninitialized (good) ^