[Bug tree-optimization/103986] [9/10 Regression] Miscompilation with -O2 -funswitch-loops and __builtin_unreachable

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jan 12 04:05:44 GMT 2022


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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This might be a latent bug in GCC 11 even.
The only difference in the IR before unswitch (besides BB reordering) is:

GCC 10.x:
  <bb 5> [local count: 1073741824]:
  # it$m_pos$x_21 = PHI <0(4), _26(13)>
  if (it$4_29 == 3)
    goto <bb 11>; [11.00%]
  else
    goto <bb 6>; [89.00%]

GCC 11+:
  <bb 10> [local count: 1073741824]:
  # it$m_pos$x_19 = PHI <0(9), _24(13)>
  if (it$4_32 != 3)
    goto <bb 3>; [89.00%]
  else
    goto <bb 11>; [11.00%]

Note bb 11 is the return.


More information about the Gcc-bugs mailing list