This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/58377] spurious "may be unused" warning with -Og
- From: "rbd at debian dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 10 Sep 2013 10:40:29 +0000
- Subject: [Bug c++/58377] spurious "may be unused" warning with -Og
- Auto-submitted: auto-generated
- References: <bug-58377-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58377
--- Comment #3 from Roland Dreier <rbd at debian dot org> ---
Even simpler test case for me:
$ cat x.cpp
// gcc -Og -Wall -Werror -c x.cpp
int pop ();
int pop_first_bucket;
int my_pop ()
{
int out;
while (pop_first_bucket)
if (pop_first_bucket && (out = pop()))
return out;
return 0;
}
$ for o in Og O0 O1 O2 O3 Ofast; do echo === $o ===; gcc -$o -Wall -Werror -c
x.cpp; done
=== Og ===
x.cpp: In function âint my_pop()â:
x.cpp:8:9: error: âoutâ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
int out;
^
cc1plus: all warnings being treated as errors
=== O0 ===
=== O1 ===
=== O2 ===
=== O3 ===
=== Ofast ===
Does not error when built as x.c:
$ cp x.cpp x.c; for o in Og O0 O1 O2 O3 Ofast; do echo === $o ===; gcc -$o
-Wall -Werror -c x.c; done
=== Og ===
=== O0 ===
=== O1 ===
=== O2 ===
=== O3 ===
=== Ofast ===