[Bug tree-optimization/105705] [12/13 Regression] std::equal triggers incorrect -Wnonnull warning

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon May 23 19:11:47 GMT 2022


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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|std::equal triggers         |[12/13 Regression]
                   |incorrect -Wnonnull warning |std::equal triggers
                   |                            |incorrect -Wnonnull warning
   Target Milestone|---                         |12.2

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
if (_14 != _15)
    goto <bb 19>; [50.00%]
  else
    goto <bb 16>; [50.00%]

...

  <bb 16> [local count: 507317172]:
  _50 = _15 - _14;
  if (_50 != 0)
    goto <bb 17>; [50.00%]
  else
    goto <bb 18>; [50.00%]

  <bb 17> [local count: 253658586]:
  _51 = (long unsigned int) _50;
  _52 = __builtin_memcmp (_14, 0B, _51);
  _53 = _52 == 0;

  <bb 18> [local count: 507317172]:
  # _54 = PHI <1(16), _53(17)>


The function call is in an unreachable basic block.

Since _15 == _14 holds true in bb16, _50 == 0 will hold true. so bb 17 is never
entered.
Looks like a pass ordering issue ...


More information about the Gcc-bugs mailing list