This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/69723] Inconsistent report of unused and uninitialized variables
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 08 Feb 2016 19:32:20 +0000
- Subject: [Bug c++/69723] Inconsistent report of unused and uninitialized variables
- Auto-submitted: auto-generated
- References: <bug-69723-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69723
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The unused variables are not warned with -Wunused-but-set-variable, because
they aren't unused, it warns (see documentation) only about variables that are
only ever set, but never read. But unused++ reads it and writes it at the same
time.
As for the uninitialized warnings, GCC has 2 passes, early uninitialized
warning pass, which is done at all levels, and warns about easy proven cases of
uninitialization (which doesn't warn, because the only uninitialized use is in
a PHI, something intentionally not tracked at that point), and then one late
uninitialized pass, which is run only in the optimization queue, after most of
the GIMPLE optimizations, which warns in the -O1/-Og cases; for -O2/-O3 does
not warn, because the whole loop is optimized away far before that.