[Bug rtl-optimization/121198] [avr][hreg-constraints] error: 'asm' operand has impossible constraints or there are not enough registers

gjl at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jul 24 11:43:48 GMT 2025


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

--- Comment #2 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Created attachment 61955
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61955&action=edit
hrc-bswapsi.diff: Proposed patch to get rig of hard regs in avr.md

This patch also runs into ICE.  It tries to get rid of hard-regs in avr.md's
bswapsi2.

unsigned long swap32 (unsigned long x)
{
    return __builtin_bswap32 (x);
}

$ avr-gcc -Os -S bswap.c 
bswap.c: In function 'swap32':
bswap.c:4:1: error: unable to find a register to spill
    4 | }
      | ^
bswap.c:4:1: error: this is the insn:
(insn 6 16 15 2 (set (reg:SI 48 [orig:43 <retval> ] [43])
        (bswap:SI (reg:SI 49 [orig:46 x ] [46]))) "bswap.c":3:12 1052
{bswapsi2}
     (expr_list:REG_DEAD (reg:SI 49 [orig:46 x ] [46])
        (nil)))
during RTL pass: reload
bswap.c:4:1: internal compiler error: in lra_split_hard_reg_for, at
lra-assigns.cc:1863

There are many more patterns with hard regs in the avr backend.  Most of them
are modelling reduced register footprints of libgcc functions that are
implemented in asm.


More information about the Gcc-bugs mailing list