https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71150
Bug ID: 71150 Summary: ICE on valid code at -O1 and above in 64-bit mode on x86_64-linux-gnu in lra_eliminate_reg_if_possible, at lra-eliminations.c:1402 Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: su at cs dot ucdavis.edu Target Milestone: --- The following code causes an ICE when compiled with the current gcc trunk at -O1 and above on x86_64-linux-gnu in the 64-bit mode. $ gcc-trunk -v Using built-in specs. COLLECT_GCC=gcc-trunk COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto --prefix=/usr/local/gcc-trunk --disable-bootstrap Thread model: posix gcc version 7.0.0 20160516 (experimental) [trunk revision 236272] (GCC) $ $ gcc-trunk -O0 -c small.c $ $ gcc-trunk -O1 -c small.c small.c: In function ‘fn2’: small.c:11:1: internal compiler error: in lra_eliminate_reg_if_possible, at lra-eliminations.c:1402 } ^ 0xa5d0fe lra_eliminate_reg_if_possible(rtx_def**) ../../gcc-source-trunk/gcc/lra-eliminations.c:1402 0xa4d9ee in_class_p ../../gcc-source-trunk/gcc/lra-constraints.c:266 0xa51031 process_addr_reg ../../gcc-source-trunk/gcc/lra-constraints.c:1320 0xa54b11 process_address_1 ../../gcc-source-trunk/gcc/lra-constraints.c:2983 0xa55ce9 process_address ../../gcc-source-trunk/gcc/lra-constraints.c:3233 0xa55ce9 curr_insn_transform ../../gcc-source-trunk/gcc/lra-constraints.c:3534 0xa5a736 lra_constraints(bool) ../../gcc-source-trunk/gcc/lra-constraints.c:4530 0xa46484 lra(_IO_FILE*) ../../gcc-source-trunk/gcc/lra.c:2290 0x9fd839 do_reload ../../gcc-source-trunk/gcc/ira.c:5381 0x9fd839 execute ../../gcc-source-trunk/gcc/ira.c:5565 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. $ -------------------------------------- long a; void fn1 () {} void fn2 () { unsigned b = (unsigned long) fn1; if (a ^ b) a--; }