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

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
And to explain what was happening,
rs6000_legitimize_address has been called on x
(plus:SI (reg/f:SI 117)
    (const_int 2147483647 [0x7fffffff]))
and mode QImode, oldx == x.
((0x7fffffff & 0xffff) ^ 0x8000) - 0x8000
is low_int -1 and
      if (low_int >= 0x8000 - extra)
is not true and 0x7fffffff - -1 is 0x80000000 (with UB on the compiler side).
So maybe the above mentioned commit wasn't sufficient and
we should
-      high_int = INTVAL (XEXP (x, 1)) - low_int;
+      high_int = UINTVAL (XEXP (x, 1)) - low_int;
But also
      && ((unsigned HOST_WIDE_INT) (INTVAL (XEXP (x, 1)) + 0x8000)
can invoke UB in the compiler, shouldn't it be just
      && ((UINTVAL (XEXP (x, 1)) + 0x8000)
?

Reply via email to