This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/69723] Inconsistent report of unused and uninitialized variables


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]