http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55060
Bug #: 55060 Summary: False un-initialized variable warnings Classification: Unclassified Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: shen...@google.com Compiler version - trunk @ 192770 Compilation option - -c -O2 -Wall Source - static void a(int *i) { } static void b(int p) { } int main(int argc, char *argv[]) { int i; a(&i); b(i); return 0; } Compilation output - /home/shenhan/test.c: In function ‘main’: /home/shenhan/test.c:7:4: warning: ‘i’ is used uninitialized in this function [-Wuninitialized] b(i); ^ A quick diagnose by David (Xingliang) Li is copied below - "The early uninitialized variable warning happens before inlining phase. Before 4.7, compiler does not warn this because the call to a(&i) which may initialize 'i' (the analysis is only intra-procedural). In 4.7 (and above), the SRA optimization pass which happens before the analysis is smart enough to replace the call to 'a' into a clone of 'a' which takes no argument. However the second access to 'i' still remains, thus the warning."