re PR target/70290 (-mavx512vl breaks parsing of C++ vector condition)
authorIlya Enkovich <enkovich.gnu@gmail.com>
Tue, 22 Mar 2016 12:31:12 +0000 (12:31 +0000)
committerIlya Enkovich <ienkovich@gcc.gnu.org>
Tue, 22 Mar 2016 12:31:12 +0000 (12:31 +0000)
gcc/cp/

PR target/70290
* call.c (build_conditional_expr_1): Always use original
condition type for vector type checks and build.

gcc/testsuite/

PR target/70290
* g++.dg/ext/pr70290.C: New test.

From-SVN: r234399

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

index adf0ddaa72f07fe5d713534844b12b0215f0ecdb..6557f9096352284e9f2c96e2386216aaa5a46af7 100644 (file)
@@ -1,3 +1,8 @@
+2016-03-22  Ilya Enkovich  <enkovich.gnu@gmail.com>
+
+       * call.c (build_conditional_expr_1): Always use original
+       condition type for vector type checks and build.
+
 2016-03-22  Patrick Palka  <ppalka@gcc.gnu.org>
 
        PR c++/70096
index 65739e4ea7f0894e14479d286041fcf22bb43f30..ed234904a63de40d13e0a087f0929ca60c1b3dc9 100644 (file)
@@ -4634,6 +4634,8 @@ build_conditional_expr_1 (location_t loc, tree arg1, tree arg2, tree arg3,
 
   if (VECTOR_INTEGER_TYPE_P (TREE_TYPE (arg1)))
     {
+      tree arg1_type = TREE_TYPE (arg1);
+
       /* If arg1 is another cond_expr choosing between -1 and 0,
         then we can use its comparison.  It may help to avoid
         additional comparison, produce more accurate diagnostics
@@ -4653,7 +4655,6 @@ build_conditional_expr_1 (location_t loc, tree arg1, tree arg2, tree arg3,
          || error_operand_p (arg3))
        return error_mark_node;
 
-      tree arg1_type = TREE_TYPE (arg1);
       arg2_type = TREE_TYPE (arg2);
       arg3_type = TREE_TYPE (arg3);
 
index 0ecfbd03caebe87800f701633843206ed9b99714..49f9e080c84eef9cadeab3443800904917a78a94 100644 (file)
@@ -1,3 +1,7 @@
+2016-03-22  Ilya Enkovich  <enkovich.gnu@gmail.com>
+
+       * g++.dg/ext/pr70290.C: New test.
+
 2016-03-22  Kirill Yukhin  <kirill.yukhin@intel.com>
 
        PR target/70325
diff --git a/gcc/testsuite/g++.dg/ext/pr70290.C b/gcc/testsuite/g++.dg/ext/pr70290.C
new file mode 100644 (file)
index 0000000..6de13ce
--- /dev/null
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mavx512vl" { target { i?86-*-* x86_64-*-* } } } */
+
+typedef int vec __attribute__((vector_size(32)));
+
+vec
+test1 (vec x,vec y)
+{
+  return (x < y) ? 1 : 0;
+}
+
+vec
+test2 (vec x,vec y)
+{
+  vec zero = { };
+  vec one = zero + 1;
+  return (x < y) ? one : zero;
+}