emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#17754: closed (Gcc 4.8.2 -Werror=maybe-unused warn


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#17754: closed (Gcc 4.8.2 -Werror=maybe-unused warning in dfa.c)
Date: Wed, 11 Jun 2014 15:10:03 +0000

Your message dated Wed, 11 Jun 2014 08:08:26 -0700
with message-id <address@hidden>
and subject line Re: bug#17754: Gcc 4.8.2 -Werror=maybe-unused warning in dfa.c
has caused the debbugs.gnu.org bug report #17754,
regarding Gcc 4.8.2 -Werror=maybe-unused warning in dfa.c
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
17754: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17754
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: Gcc 4.8.2 -Werror=maybe-unused warning in dfa.c Date: Wed, 11 Jun 2014 23:39:32 +0930 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0
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.

Reading through the code, it looks that the offending line is
only reached if (nelem > 0), and, if so, mbclen is initialised
earlier.  At the expense of some code duplication, or perhaps
the judicious use of a couple of goto's, the
(nelem == 0 || maxlen == 0) block could be split up and rearranged
such that the connection between the preceding paragraph
(nelem > 0) and the following paragraphs (transit_state_consume_1char)
would become more apparent, and the fact that mbclen is always
initialised would become clear, both to the reader and the
compiler.

cheers,

behoffski (Brenton Hoff)
Programmer, Grouse Software



--- End Message ---
--- Begin Message --- Subject: Re: bug#17754: Gcc 4.8.2 -Werror=maybe-unused warning in dfa.c Date: Wed, 11 Jun 2014 08:08:26 -0700
On Wed, Jun 11, 2014 at 7:09 AM, behoffski <address@hidden> 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.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]