http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59374
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Known to work|4.7.3, 4.9.0 |4.3.6, 4.4.7 Summary|[4.8 Regression] |[4.7/4.8/4.9 Regression] |-ftree-slp-vectorize breaks |-ftree-slp-vectorize breaks |unique_ptr's move |unique_ptr's move |constructor |constructor Known to fail| |4.6.4, 4.7.3, 4.9.0 --- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> --- Backporting this fix is hard as it depends on some of the re-org done on trunk, in particular doing dataref group analysis before dependence analysis, and then especially marking those stmts as not vectorizable that do not participate in a group. Also looking closer this isn't fixed on trunk fully either because if you trick group analysis to succeed but in the end vectorization not because you let SLP build fail then we still miscompile it: extern void abort (void); static struct X { void *a; void *b; } a, b; void __attribute__((noinline)) foo (void) { void *tem = a.b; a.b = (void *)0; b.b = tem; b.a = a.a; a.a = tem; } int main() { a.b = &a; foo (); if (b.b != &a) abort (); return 0; } t.c:7:9: note: === vect_analyze_slp === t.c:7:9: note: Build SLP for a.a = tem_2; t.c:7:9: note: Build SLP for a.b = 0B; t.c:7:9: note: Build SLP failed: different operation in stmt a.b = 0B; in this case a missed optimization, of course. Btw, 4.7.3 and 4.6.4 don't work for me for either testcase (they may work for the original C++ testcase). Wasn't able to check 4.5 right now (but it has SLP vectorization, too).