From 062c0a7b2f8dc58f8bb7c6d3448866812bfc75c1 Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Tue, 24 Apr 2018 12:18:26 +0000 Subject: [PATCH] re PR tree-optimization/85478 (ICE with single element vector) Fix PR85478 gcc/ChangeLog: 2018-04-24 Andreas Krebbel PR tree-optimization/85478 * tree-vect-loop.c (vect_analyze_loop_2): Do not call vect_grouped_store_supported for single element vectors. gcc/testsuite/ChangeLog: 2018-04-24 Andreas Krebbel PR tree-optimization/85478 * g++.dg/pr85478.C: New test. From-SVN: r259593 --- gcc/ChangeLog | 6 +++++ gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/g++.dg/pr85478.C | 46 ++++++++++++++++++++++++++++++++++ gcc/tree-vect-loop.c | 5 ++-- 4 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/pr85478.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 933cc292015..dcf0d0b9a43 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-04-24 Andreas Krebbel + + PR tree-optimization/85478 + * tree-vect-loop.c (vect_analyze_loop_2): Do not call + vect_grouped_store_supported for single element vectors. + 2018-04-24 Richard Biener PR target/85491 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b1dfe4bdb38..8c92593cac9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-04-24 Andreas Krebbel + + PR tree-optimization/85478 + * g++.dg/pr85478.C: New test. + 2018-04-23 Eric Botcazou * g++.dg/torture/pr85496.C: New test. diff --git a/gcc/testsuite/g++.dg/pr85478.C b/gcc/testsuite/g++.dg/pr85478.C new file mode 100644 index 00000000000..4eb4f2487c9 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr85478.C @@ -0,0 +1,46 @@ +/* { dg-do compile { target { s390*-*-* } } } */ +/* { dg-options "-O3 -march=arch12 -std=c++11 -Wno-return-type" } */ + +struct a { + enum { b }; +}; +struct c { + template static void f(d g, e h) { + d i; + for (; i != g; ++h, ++i) + *h = *i; + } +}; +template void j(d g, e h) { c::f(g, h); } +template void l(d g, e h) { j(g, h); } +template void aa(d g, e h) { l(g, h); } +template class ab; +template <> struct ab { + _Complex m() { return n; } + _Complex n; +}; +template <> struct ab { + ab(ab g) : n(g.m()) {} + _Complex long double n; +}; +template class p { +public: + template p &operator=(const p &); + o *ad; +}; +template class r : public p<2, o> {}; +template +template +p &p::operator=(const p &g) { + aa(&g.ad[0], &ad[0]); +} +template class s : public r { + template s &operator=(const s &); +}; +template +template +s &s::operator=(const s &g) { + p<2, ae>::operator=(g); +} +template s> &s>:: +operator=(const s> &); diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 7b3009aed2d..4ce721ed478 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -2492,8 +2492,9 @@ again: unsigned int size = STMT_VINFO_GROUP_SIZE (vinfo); tree vectype = STMT_VINFO_VECTYPE (vinfo); if (! vect_store_lanes_supported (vectype, size, false) - && ! vect_grouped_store_supported (vectype, size)) - return false; + && ! known_eq (TYPE_VECTOR_SUBPARTS (vectype), 1U) + && ! vect_grouped_store_supported (vectype, size)) + return false; FOR_EACH_VEC_ELT (SLP_INSTANCE_LOADS (instance), j, node) { vinfo = vinfo_for_stmt (SLP_TREE_SCALAR_STMTS (node)[0]);