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

            Bug ID: 116295
           Summary: [avr] unrecognizable insn when loading from
                    address-space __flash
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gjl at gcc dot gnu.org
  Target Milestone: ---

Created attachment 58877
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58877&action=edit
ice-flash.c: GNU-C99 test case

long val;

const __flash long* load4_flash (const __flash long *p)
{
    val += *p++;
    val += *p++;
    return p;
}

triggers an ICE when compiled with

$ avr-gcc ice-flash.c -S -Os

It occurs in some situations when a value from __flash is loaded:

* The device has no LPMx instruction.
* More then 2 bytes are loaded.
* Pass mfuse-add finds an optimization opportunity.

The bug can be worked around with -mno-fuse-add.

ice-flash.c: In function 'load4_flash':
ice-flash.c:8:1: error: unrecognizable insn:
    8 | }
      | ^
(insn 52 36 9 2 (parallel [
            (set (reg:SI 22 r22)
                (mem:SI (post_inc:HI (reg:HI 30 r30)) [1  S4 A8 AS1]))
            (clobber (reg:CC 36 cc))
        ]) "ice-flash.c":5:9 -1
     (expr_list:REG_UNUSED (reg:CC 36 cc)
        (expr_list:REG_INC (reg:HI 30 r30)
            (nil))))
during RTL pass: cprop_hardreg
ice-flash.c:8:1: internal compiler error: in extract_insn, at recog.cc:2848

Reply via email to