https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123295
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The bug is in lra_eliminate_regs_1.
It calls simplify_gen_subreg which I think is ok except inside a debug insn;
this subreg is valid still and we need create a subreg manually then.
just like how lra_substitute_pseudo has already similar code in it:
if (debug_p)
new_reg = gen_rtx_raw_SUBREG (mode, new_reg, offset);
else
new_reg = gen_rtx_SUBREG (mode, new_reg, offset);
This is because during debug simplification we use gen_lowpart_for_debug which
generates the subreg in the first place:
/* gen_lowpart_no_emit hook implementation for DEBUG_INSNs. In DEBUG_INSNs,
all lowpart SUBREGs are valid, despite what the machine requires for
instructions. */