[Bug tree-optimization/99919] [10/11/12/13 Regression] bogus -Wmaybe-uninitialized with a _Bool bit-field

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Dec 8 09:25:00 GMT 2022


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

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Note the uninit pass has code to deal with this special

  if (b.i)
    b.j = 0;
...

  if (b.j)
...

but it's confused by the b.j = 0 store appearing literally compared to the
b.j test being done via a (b & 2) test.  That's also a missed jump threading
opportunity and possibly a missed CSE opportunity.

b.j = b$j_10;
_3 = VIEW_CONVERT_EXPR<unsigned char>(b);
_4 = _3 & 2;

here _4 could be CSEd as b$j_10.  In fact we do have code for this in CSE
but the two pieces that would need to work together, a masked load and
partial def support, refuse to work together here.  In particular the
mask can be used to fend off not relevant non-constants and to narrow
the bits we want to fill.

Not to say SRA does a bad job on this testcase, it's also premature
optimize_bit_field_compare "optimization" here.  Maybe it's time to
kill off the case of bitfield vs constant compare "optimization".


More information about the Gcc-bugs mailing list