]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR c++/71871 (ICE on mixing templates and vector extensions ternary...
authorJakub Jelinek <jakub@redhat.com>
Tue, 19 Jul 2016 09:26:30 +0000 (11:26 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 19 Jul 2016 09:26:30 +0000 (11:26 +0200)
Backported from mainline
2016-07-18  Jakub Jelinek  <jakub@redhat.com>

PR c++/71871
* typeck.c (build_x_conditional_expr): Revert the 2012-10-25 change.

* g++.dg/ext/vector31.C: New test.

From-SVN: r238465

gcc/cp/ChangeLog
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/vector31.C [new file with mode: 0644]

index c3da35e71da1ed027fd3c3d1eacf84496d9a87bf..dd8c0005dba1515e53ffb1ef52c89ea3d1f5b689 100644 (file)
@@ -1,3 +1,11 @@
+2016-07-19  Jakub Jelinek  <jakub@redhat.com>
+
+       Backported from mainline
+       2016-07-18  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/71871
+       * typeck.c (build_x_conditional_expr): Revert the 2012-10-25 change.
+
 2016-07-07  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
index b3d3dfc77eda6f50551fcaf118f61b4e86761253..6ed91251c96e9cbda7c536c9769dae4c31903b09 100644 (file)
@@ -6055,8 +6055,7 @@ build_x_conditional_expr (location_t loc, tree ifexp, tree op1, tree op2,
     }
 
   expr = build_conditional_expr (loc, ifexp, op1, op2, complain);
-  if (processing_template_decl && expr != error_mark_node
-      && TREE_CODE (expr) != VEC_COND_EXPR)
+  if (processing_template_decl && expr != error_mark_node)
     {
       tree min = build_min_non_dep (COND_EXPR, expr,
                                    orig_ifexp, orig_op1, orig_op2);
index d61db44e0a7107afbe93517ab56868d7de069f6c..82425bb3982d4475b76d3fb3fa12f7164cd3a54f 100644 (file)
@@ -1,6 +1,11 @@
 2016-07-19  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2016-07-18  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/71871
+       * g++.dg/ext/vector31.C: New test.
+
        2016-07-11  Jakub Jelinek  <jakub@redhat.com>
 
        PR middle-end/71758
diff --git a/gcc/testsuite/g++.dg/ext/vector31.C b/gcc/testsuite/g++.dg/ext/vector31.C
new file mode 100644 (file)
index 0000000..a056839
--- /dev/null
@@ -0,0 +1,29 @@
+// PR c++/71871
+// { dg-do compile }
+
+typedef unsigned int V __attribute__ ((__vector_size__ (32)));
+
+template <int N>
+void
+foo (V *x)
+{
+  V a = *x;
+  a = a ? a : -1;
+  *x = a;
+}
+
+template <typename T>
+void
+bar (T *x)
+{
+  T a = *x;
+  a = a ? a : -1;
+  *x = a;
+}
+
+void
+test (V *x, V *y)
+{
+  foo<0> (x);
+  bar<V> (y);
+}