http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51505

             Bug #: 51505
           Summary: [4.5/4.6/4.7 Regression] ICE: in form_sum, at
                    reload.c:5349 with -O --param max-cse-insns=1
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: zso...@seznam.cz
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu


Created attachment 26050
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26050
reduced testcase

Compiler output:
$ gcc -O --param max-cse-insns=1 testcase.c
testcase.c: In function 'foo':
testcase.c:16:1: internal compiler error: in form_sum, at reload.c:5345
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

(gdb) list
5340    form_sum (enum machine_mode mode, rtx x, rtx y)
5341    {
5342      rtx tem;
5343
5344      gcc_assert (GET_MODE (x) == mode || GET_MODE (x) == VOIDmode);
5345      gcc_assert (GET_MODE (y) == mode || GET_MODE (y) == VOIDmode);
5346
5347      if (CONST_INT_P (x))
5348        return plus_constant (y, INTVAL (x));
5349      else if (CONST_INT_P (y))
(gdb) bt
#0  fancy_abort (file=0x12886d0 "/mnt/svn/gcc-trunk/gcc/reload.c", line=5345,
function=0x1289340 "form_sum")
    at /mnt/svn/gcc-trunk/gcc/diagnostic.c:898
#1  0x0000000000942b5e in form_sum (mode=DImode, x=<value optimized out>,
y=<value optimized out>) at /mnt/svn/gcc-trunk/gcc/reload.c:5345
#2  0x000000000095a94e in eliminate_regs_1 (x=0x7ffff569ae70, mem_mode=QImode,
insn=0x7ffff569ade0, may_use_invariant=Unhandled dwarf expression opcode 0xf3
)
    at /mnt/svn/gcc-trunk/gcc/reload1.c:2685
#3  0x000000000095a898 in eliminate_regs_1 (x=0x7ffff569ae58, mem_mode=QImode,
insn=0x7ffff569ade0, may_use_invariant=Unhandled dwarf expression opcode 0xf3
)
    at /mnt/svn/gcc-trunk/gcc/reload1.c:2663
#4  0x000000000095ac85 in eliminate_regs_1 (x=0x7ffff569ae40,
mem_mode=VOIDmode, insn=0x7ffff569ade0, may_use_invariant=Unhandled dwarf
expression opcode 0xf3
)
    at /mnt/svn/gcc-trunk/gcc/reload1.c:2886
#5  0x000000000095aab2 in eliminate_regs_1 (x=0x7ffff569ae28,
mem_mode=VOIDmode, insn=0x7ffff569ade0, may_use_invariant=Unhandled dwarf
expression opcode 0xf3
)
    at /mnt/svn/gcc-trunk/gcc/reload1.c:2743
#6  0x000000000095b2da in eliminate_regs_1 (x=0x7ffff569ae10,
mem_mode=VOIDmode, insn=0x7ffff569ade0, may_use_invariant=Unhandled dwarf
expression opcode 0xf3
)
    at /mnt/svn/gcc-trunk/gcc/reload1.c:2755
#7  0x000000000095b1e3 in eliminate_regs_1 (x=0x7ffff569adf8,
mem_mode=VOIDmode, insn=0x7ffff569ade0, may_use_invariant=Unhandled dwarf
expression opcode 0xf3
)
    at /mnt/svn/gcc-trunk/gcc/reload1.c:2780
#8  0x000000000095b1e3 in eliminate_regs_1 (x=0x7ffff569ade0,
mem_mode=VOIDmode, insn=0x7ffff569ade0, may_use_invariant=Unhandled dwarf
expression opcode 0xf3
)
    at /mnt/svn/gcc-trunk/gcc/reload1.c:2780
#9  0x0000000000966965 in eliminate_regs_in_insn (insn=0x7ffff555bdc8,
replace=0) at /mnt/svn/gcc-trunk/gcc/reload1.c:3623
#10 0x0000000000967ddd in calculate_needs_all_insns (global=1) at
/mnt/svn/gcc-trunk/gcc/reload1.c:1523
#11 0x0000000000968c85 in reload (first=0x7ffff5693340, global=1) at
/mnt/svn/gcc-trunk/gcc/reload1.c:945
#12 0x000000000087c670 in ira () at /mnt/svn/gcc-trunk/gcc/ira.c:3725
#13 rest_of_handle_ira () at /mnt/svn/gcc-trunk/gcc/ira.c:3798
#14 0x00000000008f8ac5 in execute_one_pass (pass=0x17be800) at
/mnt/svn/gcc-trunk/gcc/passes.c:2079
#15 0x00000000008f8e65 in execute_pass_list (pass=0x17be800) at
/mnt/svn/gcc-trunk/gcc/passes.c:2134
#16 0x00000000008f8e77 in execute_pass_list (pass=0x17beee0) at
/mnt/svn/gcc-trunk/gcc/passes.c:2135
#17 0x0000000000a5a5ee in tree_rest_of_compilation (fndecl=0x7ffff5672c00) at
/mnt/svn/gcc-trunk/gcc/tree-optimize.c:421
#18 0x00000000006ad84a in cgraph_expand_function (node=0x7ffff55636c0) at
/mnt/svn/gcc-trunk/gcc/cgraphunit.c:1818
#19 0x00000000006af5ec in cgraph_expand_all_functions () at
/mnt/svn/gcc-trunk/gcc/cgraphunit.c:1885
#20 cgraph_optimize () at /mnt/svn/gcc-trunk/gcc/cgraphunit.c:2198
#21 0x00000000006afd5a in cgraph_finalize_compilation_unit () at
/mnt/svn/gcc-trunk/gcc/cgraphunit.c:1327
#22 0x000000000058d620 in c_write_global_declarations () at
/mnt/svn/gcc-trunk/gcc/c-decl.c:10026
#23 0x00000000009edc94 in compile_file (argc=15, argv=0x7fffffffdad8) at
/mnt/svn/gcc-trunk/gcc/toplev.c:573
#24 do_compile (argc=15, argv=0x7fffffffdad8) at
/mnt/svn/gcc-trunk/gcc/toplev.c:1928
#25 toplev_main (argc=15, argv=0x7fffffffdad8) at
/mnt/svn/gcc-trunk/gcc/toplev.c:2004
#26 0x00007ffff61570ed in __libc_start_main () from /lib64/libc.so.6
#27 0x0000000000570df1 in _start ()


The testcase was reduced from gcc.target/i386/sse2-pandn-1.c, which needs more
flags:
$ gcc -O -fno-tree-loop-optimize -funroll-loops --param=max-cse-insns=1
gcc.target/i386/sse2-pandn-1.c
In file included from gcc.target/i386/sse2-pandn-1.c:13:0:
gcc.target/i386/sse2-check.h: In function 'do_test':
gcc.target/i386/sse2-check.h:13:1: internal compiler error: in form_sum, at
reload.c:5345
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Tested revisions:
r182206 - crash
4.6 r180325 - crash
4.5 r180325 - crash
4.4 r180325 - OK

Reply via email to