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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Slightly cleaned up & simplified:
int a = 1, b = -__INT_MAX__, c;

int
main ()
{
  goto d;
e:
  a = 0;
f:
  if (a + c <= 0)
    goto g;
h:
  goto i;
d:
  if (b >= 0)
    goto e;
  goto j;
i:
  if (c - __INT_MAX__ * a >= 0)
    goto h;
  goto d;
j:
  b = 7;
  goto f;
g:;
}

The slrs change is
   <bb 9> [local count: 118111600]:
-  _12 = a_lsm.8_15 * -2147483647;
-  _13 = c.1_2 + _12;
+  slsr_7 = a_lsm.8_15 * -2147483648;
+  _13 = _3 - slsr_7;
   if (_13 >= 0)
     goto <bb 10>; [0.00%]
   else
where _3 is
  _3 = c.1_2 + a_lsm.8_15;

c.1_2 is 1, a_lsm.8_15 is 1, so before slsr this is 1 + (1 * -2147483647) which
is
well defined -2147483646, while after that change it is 2 - (1 * -2147483648),
which is UB.

Reply via email to