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

--- Comment #2 from John Paul Adrian Glaubitz <glaubitz at debian dot org> ---
This LLM-generated patch fixes the issue for me:

--- a/gcc/lra-constraints.cc
+++ b/gcc/lra-constraints.cc
@@ -694,14 +694,16 @@ get_matching_reload_reg_subreg (machine_mode mode, rtx
reg,
                                enum reg_class rclass)
 {
   int hard_regno = ira_class_hard_regs[rclass][0];
+  rtx res;
   if (subreg_regno_offset (hard_regno,
                           GET_MODE (reg),
                           subreg_lowpart_offset (mode, GET_MODE (reg)),
-                          mode) == 0)
+                          mode) == 0
+      && (res = lowpart_subreg (mode, reg, GET_MODE (reg))) != NULL_RTX)
     /* For matching scalar int modes generate the right subreg byte offset for
        BE targets -- see call of reload.cc:operands_match_p in
        recog.cc:constrain_operands.  */
-    return lowpart_subreg (mode, reg, GET_MODE (reg));
+    return res;
   int offset = (lra_constraint_offset (hard_regno, GET_MODE (reg))
                - lra_constraint_offset (hard_regno, mode)) * UNITS_PER_WORD;
   lra_assert (offset >= 0);

See:
https://inbox.sourceware.org/gcc-patches/396931df3afc437128048d60fa09c7bf1a26e34f.ca...@physik.fu-berlin.de/T/#m5ecec19cd4457543928f2393282025e5f581a6ee

Reply via email to