On Wed, Jun 11, 2014 at 7:09 AM, behoffski <[email protected]> wrote: > G'day, > > Just upgraded to a recent release of gcc (previously I was running > 4.7.x): > $ gcc --version > gcc (Gentoo 4.8.2 p1.3r1, pie-0.5.8r1) 4.8.2 > Copyright (C) 2013 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There is > NO > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR > PURPOSE. > > It complains about an stack variable, mbclen, possibly being > used uninitialised in a call to transit_state_consume_1char. > > The warning message is (I'm still at 2.20 post-admin commit > ....78f07b8c8e26): > > make[2]: Entering directory `/home/grep-gnu/grep/src' > CC dfa.o > dfa.c: In function 'transit_state': > dfa.c:3213:31: error: 'mbclen' may be used uninitialized in this > function [-Werror=maybe-uninitialized] > transit_state_consume_1char (d, s, pp, wc, mbclen, match_lens); > ^ > cc1: all warnings being treated as errors > make[2]: *** [dfa.o] Error 1 > make[2]: Leaving directory `/home/grep-gnu/grep/src > > The earlier version of gcc did not complain about this code.
Thanks for the report, but... With gcc-4.9, I don't see that warning, so I suspect gcc's flow analysis has improved enough that it determines there is no risk of use-uninitialized there. Also, gcc's 4.8.2->4.8.3 delta fixed many bugs, so if you require 4.8.x, it's probably better to use 4.8.3. When enabling warnings, it's best to use the most recent version of gcc and e.g., glibc header files possible. Otherwise, we end up with false positives like this.
