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

            Bug ID: 115495
           Summary: [15 Regression] ICE in smallest_mode_for_size, at
                    stor-layout.cc:356 during combine on RISC-V
                    rv64gcv_zvl256b at -O3
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: patrick at rivosinc dot com
  Target Milestone: ---

Testcase:
extern short a[];
short b;
int main() {
  for (char c = 0; c < 18; c += 1)
    a[c + 0] = b;
}

Backtrace:
> /scratch/tc-testing/tc-jun-14/build-rv64gcv/bin/riscv64-unknown-linux-gnu-gcc 
> -march=rv64gcv_zvl256b -O3 red.c -o red.out
during RTL pass: combine
./red.c: In function 'main':
./red.c:6:1: internal compiler error: in smallest_mode_for_size, at
stor-layout.cc:356
    6 | }
      | ^
0x134a8f7 smallest_mode_for_size(poly_int<2u, unsigned long>, mode_class)
        ../../../gcc/gcc/stor-layout.cc:356
0x11fa32a smallest_int_mode_for_size(poly_int<2u, unsigned long>)
        ../../../gcc/gcc/machmode.h:916
0x11fa32a get_best_extraction_insn
        ../../../gcc/gcc/optabs-query.cc:208
0x25f7d54 make_extraction
        ../../../gcc/gcc/combine.cc:7779
0x25f903f make_compound_operation_int
        ../../../gcc/gcc/combine.cc:8186
0x25fa07f make_compound_operation(rtx_def*, rtx_code)
        ../../../gcc/gcc/combine.cc:8471
0x25fddce simplify_set
        ../../../gcc/gcc/combine.cc:6975
0x25fddce combine_simplify_rtx
        ../../../gcc/gcc/combine.cc:6374
0x260006f subst
        ../../../gcc/gcc/combine.cc:5630
0x2604101 try_combine
        ../../../gcc/gcc/combine.cc:3312
0x2609351 combine_instructions
        ../../../gcc/gcc/combine.cc:1264
0x2609351 rest_of_handle_combine
        ../../../gcc/gcc/combine.cc:15127
0x2609351 execute
        ../../../gcc/gcc/combine.cc:15171
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/zTf5nWz48

Found via fuzzer.

The fuzzer first detected this on 2024-06-07 and many times since so it was
likely caused by a patch committed a day or two before 2024-06-07.

Reply via email to