[Bug tree-optimization/67196] [10/11/12/13 Regression] loop-induced false positive from -Wmaybe-uninitialized

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Aug 30 09:40:38 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67196

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
The issue is that the code supposed to deal with this,
uninit_analysis::overlap,
does not handle the case of chained PHIs very well, that is,

<bb 5> [local count: 955630225]:
# num_captions_in_row_5 = PHI <num_captions_in_row_25(11),
num_captions_in_row_18(4)>
# first_caption_7 = PHI <first_caption_27(11), 1(4)>
# first_caption_idx_9 = PHI <first_caption_idx_29(11), i_31(4)>
i_19 = i_31 + 1;
if (n_16(D) != i_19)
  goto <bb 12>; [89.00%]
else
  goto <bb 6>; [11.00%]

...

<bb 6> [local count: 105119324]:
_2 = first_caption_7 != 0;
_3 = num_captions_in_row_5 == 1;
_4 = _2 & _3;
if (_4 != 0)
  goto <bb 7>; [38.20%]
else
  goto <bb 13>; [61.80%]

...

<bb 8> [local count: 118111600]:
# _12 = PHI <first_caption_idx_9(7), 0(13), 0(10)>
return _12;

the code searchess for a PHI definition of num_captions_in_row_5 in the
same block as the _12 = PHI <>, not realizing that uninit analysis
also includes edges from the _9 = PHI <> in BB5 where the definition
ultimatively resides.

Then there's the issue that use predicates are not yet normalized at
this point so there's still the _4 != 0 test instead of the two ANDed
ones.

With both fixed the diagnostic is gone.


More information about the Gcc-bugs mailing list