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

            Bug ID: 121426
           Summary: [hard-reg constraints] ICE: Spill fail from LRA for
                    insn with hard-reg constraints
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gjl at gcc dot gnu.org
  Target Milestone: ---

Created attachment 62066
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62066&action=edit
patch against avr.md to rewrite [u]divmodhi4 with HRCs

Working on avr.md towards PR121343 (Use HRCs instead of insns with explicit
hard-regs) I ran into this ICE:

void bar (int, char*);

void foo (int k)
{
    bar (k / 5, "one");
}

$ avr-gcc spill.c -S -mmcu=avr4 -Os -da

spill.c: In function 'foo':
spill.c:6:1: error: unable to find a register to spill
    6 | }
      | ^
spill.c:6:1: error: this is the insn:
(insn 9 20 16 2 (parallel [
            (set (reg:HI 53)
                (div:HI (reg:HI 49 [ k ])
                    (reg:HI 54 [48])))
            (set (reg:HI 55 [47])
                (mod:HI (reg:HI 49 [ k ])
                    (reg:HI 54 [48])))
            (clobber (reg:HI 56 [50]))
            (clobber (reg:QI 57 [51]))
        ]) "spill.c":5:5 588 {divmodhi4}
     (expr_list:REG_UNUSED (reg:QI 57 [51])
        (expr_list:REG_UNUSED (reg:HI 56 [50])
            (expr_list:REG_UNUSED (reg:HI 55 [47])
                (expr_list:REG_DEAD (reg:HI 54 [48])
                    (expr_list:REG_DEAD (reg:HI 49 [ k ])
                        (nil)))))))
during RTL pass: reload
dump file: spill.c.326r.reload
spill.c:6:1: internal compiler error: in lra_split_hard_reg_for, at
lra-assigns.cc:1863

This occurs with two patches: udivmodhi.diff that rewrites [u]divmodhi4 with
hard-reg constraints, and pr121198.diff which is a temtative fix for PR121198.

Target: avr
Configured with: ../../source/gcc-master/configure --target=avr --disable-nls
--with-dwarf2 --with-gnu-as --with-gnu-ld --with-long-double=64

Reply via email to