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

            Bug ID: 116283
           Summary: [15 Regression] RISC-V rv64id_zbs ICE: unrecognizable
                    insn
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: patrick at rivosinc dot com
  Target Milestone: ---

Testcase:
char c;
#define d(a, b)                                                               
\
  {                                                                           
\
    __typeof__(a) e = a;                                                      
\
    e;                                                                        
\
  }
long f;
void g(signed h[][9][9][9][9]) {
  for (unsigned i = f; i; i += 3)
    c = (d(1 << (3629 & h[i][i][1][5][i]), ));
}

Command/backtrace:
> /scratch/tc-testing/tc-compiler-fuzz-trunk/build-gcv/bin/riscv64-unknown-linux-gnu-gcc
>  -O2 -march=rv64id_zbs -c -o /dev/null func.c
func.c: In function 'g':
func.c:11:1: error: unrecognizable insn:
   11 | }
      | ^
(insn 47 26 48 3 (set (reg:DI 161)
        (and:DI (reg:DI 154 [ MEM[(int[9][9][9][9] *)h_12(D) +
112717121637492B][4294967293][1][5][4294967293] ])
            (const_int 3629 [0xe2d]))) "func.c":10:10 -1
     (expr_list:REG_DEAD (reg:DI 154 [ MEM[(int[9][9][9][9] *)h_12(D) +
112717121637492B][4294967293][1][5][4294967293] ])
        (nil)))
during RTL pass: sched1
func.c:11:1: internal compiler error: in extract_insn, at recog.cc:2869
0x2de6365 internal_error(char const*, ...)
        ../../../gcc/gcc/diagnostic-global-context.cc:491
0xc50982 fancy_abort(char const*, int, char const*)
        ../../../gcc/gcc/diagnostic.cc:1772
0xae39b5 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
        ../../../gcc/gcc/rtl-error.cc:108
0xae39d7 _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
        ../../../gcc/gcc/rtl-error.cc:116
0xae228b extract_insn(rtx_insn*)
        ../../../gcc/gcc/recog.cc:2869
0x114c8c7 scan_one_insn
        ../../../gcc/gcc/ira-costs.cc:1546
0x114c8c7 process_bb_for_costs
        ../../../gcc/gcc/ira-costs.cc:1748
0x114ea8f find_costs_and_classes
        ../../../gcc/gcc/ira-costs.cc:2032
0x114f446 ira_set_pseudo_classes(bool, _IO_FILE*)
        ../../../gcc/gcc/ira-costs.cc:2618
0x2791c97 alloc_global_sched_pressure_data
        ../../../gcc/gcc/haifa-sched.cc:7205
0x2791c97 sched_init()
        ../../../gcc/gcc/haifa-sched.cc:7360
0x279345e haifa_sched_init()
        ../../../gcc/gcc/haifa-sched.cc:7372
0x132517a schedule_insns()
        ../../../gcc/gcc/sched-rgn.cc:3517
0x1325840 schedule_insns()
        ../../../gcc/gcc/sched-rgn.cc:3511
0x1325840 rest_of_handle_sched
        ../../../gcc/gcc/sched-rgn.cc:3729
0x1325840 execute
        ../../../gcc/gcc/sched-rgn.cc:3839
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Godbolt: https://godbolt.org/z/Eq5MoTqEo

Found via fuzzer.

Reply via email to