https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69030
Bug ID: 69030 Summary: ICE on x86_64-linux-gnu at -O2 and above in 32-bit mode (ICE in copy_rtx, at rtl.c:358) Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: chengniansun at gmail dot com Target Milestone: --- The following code crashes gcc-trunk at -O2 and -O3 on x86_64-linux-gnu in 32-bit mode (not in 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/6.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk --enable-languages=c,c++ --disable-werror --enable-multilib Thread model: posix gcc version 6.0.0 20151222 (experimental) [trunk revision 231896] (GCC) $: $: gcc-trunk -m32 small.c -w -g -O3 small.c: In function ‘main’: small.c:25:1: internal compiler error: in copy_rtx, at rtl.c:358 } ^ 0xa87c13 copy_rtx(rtx_def*) ../../gcc-trunk/gcc/rtl.c:358 0x99e7d4 remove_pseudos ../../gcc-trunk/gcc/lra-spills.c:426 0x99e77f remove_pseudos ../../gcc-trunk/gcc/lra-spills.c:435 0x99e77f remove_pseudos ../../gcc-trunk/gcc/lra-spills.c:435 0x99f0b3 spill_pseudos ../../gcc-trunk/gcc/lra-spills.c:474 0x99f0b3 lra_spill() ../../gcc-trunk/gcc/lra-spills.c:586 0x9800ed lra(_IO_FILE*) ../../gcc-trunk/gcc/lra.c:2367 0x936f99 do_reload ../../gcc-trunk/gcc/ira.c:5385 0x936f99 execute ../../gcc-trunk/gcc/ira.c:5556 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. $: $: gcc-trunk -m32 small.c -w -g -O2 small.c: In function ‘main’: small.c:25:1: internal compiler error: Segmentation fault } ^ 0xaed4af crash_signal ../../gcc-trunk/gcc/toplev.c:334 0x995f83 lra_eliminate_regs_1(rtx_insn*, rtx_def*, machine_mode, bool, bool, long, bool) ../../gcc-trunk/gcc/lra-eliminations.c:664 0x99e812 remove_pseudos ../../gcc-trunk/gcc/lra-spills.c:425 0x99e77f remove_pseudos ../../gcc-trunk/gcc/lra-spills.c:435 0x99e77f remove_pseudos ../../gcc-trunk/gcc/lra-spills.c:435 0x99f0b3 spill_pseudos ../../gcc-trunk/gcc/lra-spills.c:474 0x99f0b3 lra_spill() ../../gcc-trunk/gcc/lra-spills.c:586 0x9800ed lra(_IO_FILE*) ../../gcc-trunk/gcc/lra.c:2367 0x936f99 do_reload ../../gcc-trunk/gcc/ira.c:5385 0x936f99 execute ../../gcc-trunk/gcc/ira.c:5556 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. $: $: cat small.c int a, b, c = 7, d; static unsigned e, g; char f; static unsigned fn1() { unsigned h = e - b ^ c; int i = h / c & a * g, j = g * h; if (h) { if (d) h = e; j = a; a = (a && (g % f && i) % h) | c | ~2; if (b) printf("", 1); } c = i; a = j; return 2; } int main() { for (; b < -18; --b) g = 0; fn1(); return 0; } $: