This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Silence some uninitialized variable warnings that appear when bootstrapping
- From: Eric Gallager <egall at gwmail dot gwu dot edu>
- To: Manuel López-Ibáñez <lopezibanez at gmail dot com>
- Cc: Segher Boessenkool <segher at kernel dot crashing dot org>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 2 Sep 2016 17:08:34 -0400
- Subject: Re: [PATCH] Silence some uninitialized variable warnings that appear when bootstrapping
- Authentication-results: sourceware.org; auth=none
- References: <CAMfHzOtxiecXKsixT7uYSMYp4jxpJ4+YCyW4u=3NyzEs6ajNAg@mail.gmail.com> <20160902153132.GA19656@gate.crashing.org> <CAMfHzOv0NcLinUMFJM2=kfM6vzkb2Ajb9JxZiiByCYffBF-bFA@mail.gmail.com> <20160902192733.GA7983@gate.crashing.org> <1a4528e0-a3e6-1aad-fd7a-7657530c5a92@gmail.com>
On 9/2/16, Manuel López-Ibáñez <lopezibanez@gmail.com> wrote:
> On 02/09/16 20:27, Segher Boessenkool wrote:
>> On Fri, Sep 02, 2016 at 02:21:07PM -0400, Eric Gallager wrote:
>>> ../../gcc/combine.c: In function ‘int combine_instructions(rtx_insn*,
>>> unsigned int)’:
>>> ../../gcc/combine.c:1310:8: warning: ‘prev’ may be used uninitialized
>>> in this function [-Wmaybe-uninitialized]
>>> if ((next = try_combine (insn, prev, NULL, NULL,
>>> ^~
>>
>> That is:
>>
>> if (HAVE_cc0
>> && JUMP_P (insn)
>> && (prev = prev_nonnote_insn (insn)) != 0
>> && NONJUMP_INSN_P (prev)
>> && sets_cc0_p (PATTERN (prev)))
>> {
>> if ((next = try_combine (insn, prev, NULL, NULL,
>> &new_direct_jump_p,
>> last_combined_insn)) != 0)
>>
>> so prev is always initialised here. Could you try to find out why GCC
>> warns anyway? Or open a PR?
>>
>> HAVE_cc0 probably expands to 0 (I'm not sure what your target is), that
>> might have something to do with it.
>
> Unfortunately, the location reported by GCC is sometimes wrong, because
> location tracking in the middle-end is far from perfect.
> https://gcc.gnu.org/PR40635 https://gcc.gnu.org/PR53917
>
> The only way to know for sure what GCC is warning about is to look at the
> uninit dump.
How exactly do I generate an uninit dump? I'm not seeing any relevant
options in the GCC manual...
>
> Moreover, if the warning is bogus and not a regression, it is very likely
> that it is reported already here:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24639
>
> The effort dedicated to report and analyze the report would be better spent
> fixing any of the issues already known.
>
> Nevertheless, assignments within 'if' are one of the things that make
> reading GCC code harder than it needs to be (and combine.c is scary).
So would a patch to move the assignment out of the 'if' be better then?
(Also, what about the one in varasm.c?)