[Bug c/45493] New: -Wuninitialized does not warn
When the first use of an uninitialized variable is inside a loop, no warning is generated when -Wuninitialized is turned on. int main(void) { int len, i; for(i = 0; i < 5; i++) { printf("%d\n", len);// no warning! len = 10; } return 0; } -- Summary: -Wuninitialized does not warn Product: gcc Version: 4.4.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: tadhunt at gmail dot com GCC build triplet: x86_64-linux-gnu GCC host triplet: x86_64-linux-gnu GCC target triplet: x86_64-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45493
[Bug c/45493] -Wuninitialized does not warn
--- Comment #1 from tadhunt at gmail dot com 2010-09-02 03:42 --- Same behavior on 4.4.3 & 4.4.1 (same host, target & build) Forgot to mention: gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu9) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45493
[Bug c/42884] GCC (v4.3.3) fails to detect uninitialized variable
--- Comment #19 from tadhunt at gmail dot com 2010-09-02 16:01 --- This flamewar in the comments is hilarious. To all concerned, here is a much simpler example. This does appear to be a regression. I apologize that I cannot help fix it, as it's a really useful feature that helps catch bugs. Hat's off to you folks working hard on gcc. int main(void) { int len, i; for(i = 0; i < 5; i++) { printf("%d\n", len);// no warning! len = 10; } return 0; } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42884
[Bug c/45493] -Wuninitialized does not warn
--- Comment #3 from tadhunt at gmail dot com 2010-09-02 16:08 --- (In reply to comment #2) Richard, thanks for the confirmation. This is a great feature that we've come to rely on over the years for catching rookie errors. This might not appear in comments very often, but I appreciate the hard work you and the rest of the gcc folks put in. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45493