Created attachment 29408 [details] Preprocessed file, comment, compiler call, compiler configuration Compiling a loop over an array of struct with members of type float leads to: internal compiler error: Segmentation Fault Occurs optimizing with -O3 Affected gcc versions: 4.7.2, 4.6.3, 4.6.1, 4.5.2 (at least) NOT affected versions: 3.4.3 (at least) Platforms: Solaris 11.1, Ubuntu 12.04.2 LTS (precise), Linux Mint 12 (Lisa); (Ubuntu and LinuxMint in Virtual Box) Solaris uname -a: SunOS xxx 5.11 11.1 i86pc i386 i86pc Ubuntu uname -a Linux xxx 3.2.0-37-generic #58-Ubuntu SMP Thu Jan 24 15:28:10 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux LinuxMint uname -a: Linux xxx 3.0.0-12-generic #20-Ubuntu SMP Fri Oct 7 14:56:25 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux Attachment contains preprocessed file and further information
pinskia@server:~/src/local$ ~/local-gcc/bin/x86_64-unknown-linux-gnu-gcc-4.7.0 -O3 t.c mbb.c: In function ‘Compute’: mbb.c:33:6: internal compiler error: vector VEC(tree,base) index domain error, in vectorizable_store at tree-vect-stmts.c:3920 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. But works on the trunk.
This was fixed for 4.8 by Jan Hubicka's r193175, which rewrote finite_loop_p in tree-ssa-loop-niter.c. That patch doesn't work as-is in 4.7.2 (it applies but uses other things which aren't in 4.7.2.) The SEGV in 4.7.2 occurs in tree-vect-stmts.c:3938 3938 gcc_assert (useless_type_conversion_p (vectype, 3939 TREE_TYPE (vec_oprnd))); because vec_oprnd is NULL at that point.
Confirmed. Probably a latent issue on trunk. Mine.
Also ICEs on trunk for me with -O1 -ftree-vectorize. Works with 4.3 at least.
Reduced testcase: typedef struct { float l, h; } tFPinterval; tFPinterval X[1024]; tFPinterval Y[1024]; tFPinterval Z[1024]; void Compute(void) { int d; for (d= 0; d < 1024; d++) { Y[d].l= X[d].l + X[d].h; Y[d].h= Y[d].l; Z[d].l= X[d].l; Z[d].h= X[d].h; } }
We don't properly "vectorize" the 2nd reference to the load (this time unpermuted). When vectorizing the 2nd SLP instance with that reference we encounter /* Check if the chain of loads is already vectorized. */ if (STMT_VINFO_VEC_STMT (vinfo_for_stmt (first_stmt))) { *vec_stmt = STMT_VINFO_VEC_STMT (stmt_info); return true; } but that leaves SLP_TREE_VEC_STMTS unpopulated. Shared nodes between SLP instances seem to be somewhat fragile ... Especially in this case in which even wrong-code would occur as the instances do not share the same permutation. if (slp && !SLP_INSTANCE_LOAD_PERMUTATION (slp_node_instance).exists () && first_stmt != SLP_TREE_SCALAR_STMTS (slp_node)[0]) first_stmt = SLP_TREE_SCALAR_STMTS (slp_node)[0]; also doesn't make much sense to me - instead it probably should be asserted: if (slp && first_stmt != SLP_TREE_SCALAR_STMTS (slp_node)[0]) gcc_assert (SLP_INSTANCE_LOAD_PERMUTATION (slp_node_instance).exists ()) but bb-slp-29.c asserts here. Easiest is for now to clear STMT_VINFO_VEC_STMT for all loads after scheduling an SLP instance.
Author: rguenth Date: Tue Mar 5 09:54:29 2013 New Revision: 196458 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=196458 Log: 2013-03-05 Richard Biener <rguenther@suse.de> PR tree-optimization/56270 * tree-vect-slp.c (vect_schedule_slp): Clear vectorized stmts of loads after scheduling an SLP instance. * gcc.dg/vect/slp-38.c: New testcase. Added: trunk/gcc/testsuite/gcc.dg/vect/slp-38.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-vect-slp.c
Fixed on trunk sofar.
Author: rguenth Date: Tue Mar 26 10:12:52 2013 New Revision: 197096 URL: http://gcc.gnu.org/viewcvs?rev=197096&root=gcc&view=rev Log: 2013-03-26 Richard Biener <rguenther@suse.de> Backport from mainline 2013-03-13 Richard Biener <rguenther@suse.de> PR tree-optimization/56608 * tree-vect-slp.c (vect_schedule_slp): Do not remove scalar calls when vectorizing basic-blocks. * gcc.dg/vect/fast-math-bb-slp-call-3.c: New testcase. 2013-03-05 Richard Biener <rguenther@suse.de> PR tree-optimization/56270 * tree-vect-slp.c (vect_schedule_slp): Clear vectorized stmts of loads after scheduling an SLP instance. * gcc.dg/vect/slp-38.c: New testcase. Added: branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/vect/fast-math-bb-slp-call-3.c branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/vect/slp-38.c Modified: branches/gcc-4_7-branch/gcc/ChangeLog branches/gcc-4_7-branch/gcc/testsuite/ChangeLog branches/gcc-4_7-branch/gcc/tree-vect-slp.c
The 4.6 branch has been closed, fixed in GCC 4.7.3.