https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84279
--- Comment #6 from Peter Bergner <bergner at gcc dot gnu.org> ---
(In reply to Segher Boessenkool from comment #5)
> I think you should do this check inside address_offset?
I don't think that is possible. The callers of address_offset assume if
address_offset returns a non-NULL rtx, then it *IS* a constant (eg, they use
INTVAL() on its return value). The problematical address we have here doesn't
have constant offset, so to "change" anything, we'd have to return non-NULL
(otherwise we return true from mem_operand_gpr) and that would cause issues
with INTVAL...or I'd have to guard all return values of address_offset.
I'll also note that the patch also matches the usage of mem_operand_ds_form()
which also has an early out for an unsupported case before it calls
address_offset:
bool
mem_operand_ds_form (rtx op, machine_mode mode)
{
unsigned HOST_WIDE_INT offset;
int extra;
rtx addr = XEXP (op, 0);
if (!offsettable_address_p (false, mode, addr))
return false;
op = address_offset (addr);
if (op == NULL_RTX)
return true;
...