This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][genrecog] Fix warning about potentially uninitialised use of label
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: Kyrill Tkachov <kyrylo dot tkachov at foss dot arm dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 02 May 2016 10:47:59 +0100
- Subject: Re: [PATCH][genrecog] Fix warning about potentially uninitialised use of label
- Authentication-results: sourceware.org; auth=none
- References: <5723516A dot 2020606 at foss dot arm dot com>
Kyrill Tkachov <kyrylo.tkachov@foss.arm.com> writes:
> Hi all,
>
> I'm getting a warning when building genrecog that 'label' may be used
> uninitialised in:
>
> uint64_t label = 0;
>
> if (d->test.kind == rtx_test::CODE
> && d->if_statement_p (&label)
> && label == CONST_INT)
>
> This is because if_statement_p looks like this:
> inline bool
> decision::if_statement_p (uint64_t *label) const
> {
> if (singleton () && first->labels.length () == 1)
> {
> if (label)
> *label = first->labels[0];
> return true;
> }
> return false;
> }
>
> It's not guaranteed to write label.
It is guaranteed to write to label on a true return though, so it looks
like a false positive. Is current GCC warning for this or are you using
an older host compiler?
Thanks,
Richard