This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/65178] New: incorrect -Wmaybe-uninitialized when nested loops
- From: "winter-gcc at bfw-online dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 23 Feb 2015 15:49:50 +0000
- Subject: [Bug tree-optimization/65178] New: incorrect -Wmaybe-uninitialized when nested loops
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65178
Bug ID: 65178
Summary: incorrect -Wmaybe-uninitialized when nested loops
Product: gcc
Version: 4.9.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: winter-gcc@bfw-online.de
Created attachment 34845
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34845&action=edit
Testcase
This program incorrectly warns about an uninitialized variable.
If one is to delete the innermost loop definition (leaving the loop body
intact), the warning would not be displayed.
--- main.c 2015-02-23 16:48:56.027694790 +0100
+++ main2.c 2015-02-23 16:49:13.585385504 +0100
@@ -10,7 +10,7 @@
{ char *buf;
char *p = 0;
for (bool a = true;; a = false)
- { for (char *s = c; *s; ++s)
+ { // for (char *s = c; *s; ++s)
{ if (!a) *p = 'a';
}
if (!a) break;