http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52170
Bug #: 52170 Summary: ICE in trunc_int_for_mode, at explow.c:57 during simplify_plus_minus Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: greta.yo...@arm.com Created attachment 26609 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26609 testcase that triggers the ICE cc1 -quiet -mcpu=cortex-a9 -mfloat-abi=softfp -mfpu=neon -O3 smallest.c smallest.c: In function 'f0a': smallest.c:24:1: internal compiler error: in trunc_int_for_mode, at explow.c:57 57: gcc_assert (SCALAR_INT_MODE_P (mode)); (gdb) info stack #0 fancy_abort (file=0x132ccd0 "/work/local-checkouts/gcc-fsf/gcc/explow.c", line=57, function=0x132d130 "trunc_int_for_mode") at /work/local-checkouts/gcc-fsf/gcc/diagnostic.c:899 #1 0x0000000000753919 in trunc_int_for_mode (c=1, mode=V16QImode) at /work/local-checkouts/gcc-fsf/gcc/explow.c:57 #2 0x000000000073c90f in gen_int_mode (c=1, mode=V16QImode) at /work/local-checkouts/gcc-fsf/gcc/emit-rtl.c:421 #3 0x0000000000adba40 in neg_const_int (mode=V16QImode, i=0x7ffff765c460) at /work/local-checkouts/gcc-fsf/gcc/simplify-rtx.c:70 #4 0x0000000000ae96bf in simplify_plus_minus (code=MINUS, mode=V16QImode, op0=0x7ffff75f17e0, op1=0x7ffff76010e0) at /work/local-checkouts/gcc-fsf/gcc/simplify-rtx.c:3963 #5 0x0000000000ae2e20 in simplify_binary_operation_1 (code=MINUS, mode=V16QImode, op0=0x7ffff75f17e0, op1=0x7ffff76010e0, trueop0=0x7ffff75f17e0, trueop1=0x7ffff76010e0) at /work/local-checkouts/gcc-fsf/gcc/simplify-rtx.c:2307 #6 0x0000000000ae1049 in simplify_binary_operation (code=MINUS, mode=V16QImode, op0=0x7ffff75f17e0, op1=0x7ffff76010e0) at /work/local-checkouts/gcc-fsf/gcc/simplify-rtx.c:1909 #7 0x0000000001116fe8 in combine_simplify_rtx (x=0x7ffff75f1828, op0_mode=V16QImode, in_dest=0, in_cond=0) at /work/local-checkouts/gcc-fsf/gcc/combine.c:5459 #8 0x000000000111688a in subst (x=0x7ffff75f1828, from=0x7ffff75ff800, to=0x7ffff75f17e0, in_dest=0, in_cond=0, unique_copy=0) at /work/local-checkouts/gcc-fsf/gcc/combine.c:5292 #9 0x0000000001116674 in subst (x=0x7ffff75f1840, from=0x7ffff75ff800, to=0x7ffff75f17e0, in_dest=0, in_cond=0, unique_copy=0) at /work/local-checkouts/gcc-fsf/gcc/combine.c:5228 #10 0x0000000001110569 in try_combine (i3=0x7ffff7600678, i2=0x7ffff7600630, i1=0x7ffff76005e8, i0=0x0, new_direct_jump_p=0x7fffffffe05c, last_combined_insn=0x7ffff7600678) at /work/local-checkouts/gcc-fsf/gcc/combine.c:3253 #11 0x000000000110b0d8 in combine_instructions (f=0x7ffff75c4a00, nregs=582) at /work/local-checkouts/gcc-fsf/gcc/combine.c:1340 #12 0x000000000112be4d in rest_of_handle_combine () at /work/local-checkouts/gcc-fsf/gcc/combine.c:13953 #13 0x0000000000a238cf in execute_one_pass (pass=0x18e6500) at /work/local-checkouts/gcc-fsf/gcc/passes.c:2081 #14 0x0000000000a23abd in execute_pass_list (pass=0x18e6500) at /work/local-checkouts/gcc-fsf/gcc/passes.c:2136 #15 0x0000000000a23ade in execute_pass_list (pass=0x18dcb40) at /work/local-checkouts/gcc-fsf/gcc/passes.c:2137 #16 0x0000000000bc8d2a in tree_rest_of_compilation (fndecl=0x7ffff759c300) at /work/local-checkouts/gcc-fsf/gcc/tree-optimize.c:422 #17 0x000000000069e420 in cgraph_expand_function (node=0x7ffff75c1000) at /work/local-checkouts/gcc-fsf/gcc/cgraphunit.c:1829 #18 0x000000000069e5eb in cgraph_expand_all_functions () at /work/local-checkouts/gcc-fsf/gcc/cgraphunit.c:1896 #19 0x000000000069f131 in cgraph_optimize () at /work/local-checkouts/gcc-fsf/gcc/cgraphunit.c:2210 #20 0x000000000069c16d in cgraph_finalize_compilation_unit () at /work/local-checkouts/gcc-fsf/gcc/cgraphunit.c:1338 #21 0x00000000004cd66d in c_write_global_declarations () at /work/local-checkouts/gcc-fsf/gcc/c-decl.c:10030 #22 0x0000000000b1634a in compile_file () at /work/local-checkouts/gcc-fsf/gcc/toplev.c:573 #23 0x0000000000b185a8 in do_compile () at /work/local-checkouts/gcc-fsf/gcc/toplev.c:1938 #24 0x0000000000b1871f in toplev_main (argc=7, argv=0x7fffffffe448) at /work/local-checkouts/gcc-fsf/gcc/toplev.c:2014 #25 0x00000000005ce980 in main (argc=7, argv=0x7fffffffe448) at /work/local-checkouts/gcc-fsf/gcc/main.c:36 Fails on trunk. The problem seems to be that the "mode" argument of simplify_plus_minus, which satisfies INTEGRAL_MODE_P (mode), is passed on to trunc_int_for_mode, which requires stronger SCALAR_INT_MODE_P (mode). The assert fails in the attached test case, because the mode is V16QImode a vector mode not scalar mode.