On 05/02/2016 03:47 AM, Richard Sandiford wrote:
Kyrill Tkachov <kyrylo.tkac...@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?
And if it's warning with the current trunk, we should open a BZ with a suitable testcase. DOM/VRP should have detected this and removed the path with the uninitialized use from the CFG, if it didn't then it's a bug worth filing.

jeff

Reply via email to