http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56707
Bug #: 56707
Summary: [4.7 regression] ICE in distance_non_agu_define_in_bb
for -mtune=atom -O2
Classification: Unclassified
Product: gcc
Version: 4.7.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: [email protected]
ReportedBy: [email protected]
Created attachment 29712
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29712
Reduced testcase
With gcc-4.7 compiled as:
./configure --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu
--disable-werror --enable-languages=c,c++
attached testcase fails for:
build/gcc/cc1plus -mtune=atom -O2 bug461694.i
Program received signal SIGSEGV, Segmentation fault.
distance_non_agu_define_in_bb (...)
at /dev/shm/gcc/gcc/config/i386/i386.c:16558
16558 if (prev == BB_HEAD (bb))
yielding:
#0 distance_non_agu_define_in_bb (regno1=regno1@entry=3,
regno2=regno2@entry=4294967295,
insn=insn@entry=0x7ffff5d661b0, distance=distance@entry=2,
start=<optimized out>,
found=found@entry=0x7fffffffe23b "") at
/dev/shm/gcc/gcc/config/i386/i386.c:16558
#1 0x0000000000c4adbc in distance_non_agu_define (insn=0x7ffff5d661b0,
regno2=4294967295, regno1=3)
at /dev/shm/gcc/gcc/config/i386/i386.c:16612
#2 ix86_lea_outperforms (insn=0x7ffff5d661b0, regno0=0, regno1=3,
regno2=4294967295, split_cost=0)
at /dev/shm/gcc/gcc/config/i386/i386.c:16782
#3 0x0000000000d862f0 in output_53 (operands=0x1631ac0 <recog_data>,
insn=0x7ffff5d661b0)
at /dev/shm/gcc/gcc/config/i386/i386.md:2224
#4 0x0000000000827bd3 in final_scan_insn (insn=insn@entry=0x7ffff5d661b0,
file=file@entry=0x16b2ef0,
optimize_p=optimize_p@entry=2, nopeepholes=nopeepholes@entry=0,
seen=seen@entry=0x7fffffffe39c)
at /dev/shm/gcc/gcc/final.c:2682
#5 0x0000000000828690 in final (first=0x7ffff5d45a00, file=0x16b2ef0,
optimize_p=2) at /dev/shm/gcc/gcc/final.c:1786
#6 0x000000000082898a in rest_of_handle_final () at
/dev/shm/gcc/gcc/final.c:4319
#7 0x000000000097b23d in execute_one_pass (pass=pass@entry=0x1519d60
<pass_final>) at /dev/shm/gcc/gcc/passes.c:2180
#8 0x000000000097b5c5 in execute_pass_list (pass=0x1519d60 <pass_final>) at
/dev/shm/gcc/gcc/passes.c:2235
#9 0x000000000097b5d7 in execute_pass_list (pass=0x151aa40
<pass_postreload>) at /dev/shm/gcc/gcc/passes.c:2236
#10 0x000000000097b5d7 in execute_pass_list (pass=0x151aaa0
<pass_rest_of_compilation>)
at /dev/shm/gcc/gcc/passes.c:2236
#11 0x0000000000774397 in tree_rest_of_compilation (node=0x7ffff5c1c850) at
/dev/shm/gcc/gcc/cgraphunit.c:1898
#12 0x0000000000778b12 in cgraph_expand_function (node=0x7ffff5c1c850) at
/dev/shm/gcc/gcc/cgraphunit.c:1968
#13 0x000000000077aaaf in cgraph_expand_all_functions () at
/dev/shm/gcc/gcc/cgraphunit.c:2033
#14 cgraph_optimize () at /dev/shm/gcc/gcc/cgraphunit.c:2724
#15 0x000000000077afb5 in cgraph_finalize_compilation_unit () at
/dev/shm/gcc/gcc/cgraphunit.c:2810
#16 0x00000000005ac36b in cp_write_global_declarations () at
/dev/shm/gcc/gcc/cp/decl2.c:4072
#17 0x0000000000a17f4a in compile_file () at /dev/shm/gcc/gcc/toplev.c:572
#18 do_compile () at /dev/shm/gcc/gcc/toplev.c:1938
#19 toplev_main (argc=4, argv=0x7fffffffe6b8) at
/dev/shm/gcc/gcc/toplev.c:2014
#20 0x00007ffff664d9b5 in __libc_start_main (main=0x4d13b0 <main>, argc=4,
ubp_av=0x7fffffffe6b8,
init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>,
stack_end=0x7fffffffe6a8)
at libc-start.c:225
Regression was introduced by:
http://gcc.gnu.org/viewcvs/gcc?view=revision&revision=181077 (bug 50962)
ICE disappears with:
http://gcc.gnu.org/viewcvs/gcc?view=revision&revision=186451
Bug is still present in gcc-4.7 branch. Tested with:
svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@197001
Please check if revision 186451 is a proper fix and backport to gcc-4.7 branch.
TIA!