https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101351
Bug ID: 101351
Summary: ICE on valid code with -O1: in lra_split_hard_reg_for,
at lra-assigns.c:1837
Product: gcc
Version: tree-ssa
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: cnsun at uwaterloo dot ca
Target Milestone: ---
$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.t468jxVWYr-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210706 (experimental) [master revision
:e442981a9:a3543b5e8002c033b2304d7ac1d1e58218eebb51] (GCC)
$ cat mutant.c
foo() {
register _Complex long a asm("rax");
return a / 10;
}
$ gcc-trunk -w -O1 mutant.c
mutant.c: In function ‘foo’:
mutant.c:4:1: error: unable to find a register to spill
4 | }
| ^
mutant.c:4:1: error: this is the insn:
(insn 6 19 7 2 (parallel [
(set (reg:DI 87)
(truncate:DI (lshiftrt:TI (mult:TI (sign_extend:TI (reg:DI 93
[91]))
(sign_extend:TI (reg:DI 88)))
(const_int 64 [0x40]))))
(clobber (reg:DI 93 [91]))
(clobber (reg:CC 17 flags))
]) "mutant.c":3:12 439 {*smuldi3_highpart_1}
(expr_list:REG_UNUSED (reg:DI 93 [91])
(expr_list:REG_DEAD (reg:DI 88)
(expr_list:REG_UNUSED (reg:CC 17 flags)
(expr_list:REG_EQUAL (truncate:DI (lshiftrt:TI (mult:TI
(sign_extend:TI (reg:DI 0 ax [ a ]))
(const_int 7378697629483820647
[0x6666666666666667]))
(const_int 64 [0x40])))
(nil))))))
during RTL pass: reload
mutant.c:4:1: internal compiler error: in lra_split_hard_reg_for, at
lra-assigns.c:1837
0x73f51f _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
/tmp/tmp.t468jxVWYr-gcc-builder/gcc/gcc/rtl-error.c:108
0xd776e6 lra_split_hard_reg_for()
/tmp/tmp.t468jxVWYr-gcc-builder/gcc/gcc/lra-assigns.c:1837
0xd71ba9 lra(_IO_FILE*)
/tmp/tmp.t468jxVWYr-gcc-builder/gcc/gcc/lra.c:2412
0xd26c69 do_reload
/tmp/tmp.t468jxVWYr-gcc-builder/gcc/gcc/ira.c:5822
0xd26c69 execute
/tmp/tmp.t468jxVWYr-gcc-builder/gcc/gcc/ira.c:6008
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.