https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116240
Bug ID: 116240 Summary: RISC-V: ICE during RTL pass: combine with -fwrapv -march=rv64imv_xtheadcondmov_xventanacondops at -O2 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: int a, b; void c() { int e = a >= 2 ? b : a; short d = e * 2; if (d) for (;;) ; } Command/backtrace: > /scratch/tc-testing/tc-compiler-fuzz-trunk/build-gcv/bin/riscv64-unknown-linux-gnu-gcc > -fwrapv -O2 -march=rv64imvxtheadcondmov_xventanacondops red.c -c -S -o > /dev/null during RTL pass: combine red.c: In function 'c': red.c:8:1: internal compiler error: Segmentation fault 8 | } | ^ 0x2de6255 internal_error(char const*, ...) ../../../gcc/gcc/diagnostic-global-context.cc:491 0x1388d33 crash_signal ../../../gcc/gcc/toplev.cc:321 0x759e6644251f ??? ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0 0x1310816 rtx_equal_p(rtx_def const*, rtx_def const*, bool (*)(rtx_def const**, rtx_def const**, rtx_def**, rtx_def**)) ../../../gcc/gcc/rtl.cc:442 0x179f0a5 riscv_rtx_costs ../../../gcc/gcc/config/riscv/riscv.cc:3650 0x1318e37 rtx_cost(rtx_def*, machine_mode, rtx_code, int, bool) ../../../gcc/gcc/rtlanal.cc:4605 0x268427c set_src_cost(rtx_def*, machine_mode, bool) ../../../gcc/gcc/rtl.h:2953 0x268427c force_int_to_mode ../../../gcc/gcc/combine.cc:8833 0x268427c force_to_mode ../../../gcc/gcc/combine.cc:8747 0x26840d2 force_int_to_mode ../../../gcc/gcc/combine.cc:8991 0x26840d2 force_to_mode ../../../gcc/gcc/combine.cc:8747 0x2689dcb make_compound_operation_int ../../../gcc/gcc/combine.cc:8393 0x268a32f make_compound_operation(rtx_def*, rtx_code) ../../../gcc/gcc/combine.cc:8471 0x268a2fb make_compound_operation(rtx_def*, rtx_code) ../../../gcc/gcc/combine.cc:8496 0x268e07e simplify_set ../../../gcc/gcc/combine.cc:6975 0x268e07e combine_simplify_rtx ../../../gcc/gcc/combine.cc:6374 0x269031f subst ../../../gcc/gcc/combine.cc:5630 0x2694499 try_combine ../../../gcc/gcc/combine.cc:3349 0x2699d19 combine_instructions ../../../gcc/gcc/combine.cc:1285 0x2699d19 rest_of_handle_combine ../../../gcc/gcc/combine.cc:15127 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. This is a bit of an obscure bug since it's mixing two vendor extensions. If ISA strings like this aren't interesting let me know and I'll make the vendor extensions mutually exclusive during fuzzing. Found via fuzzer.