Hi!

We ICE on the following testcase.  There are multiple issues, this patch
fixes just the ICE part; INTEGER_CST rhs1 is completely valid on COND_EXPR,
though of course a sign of missed optimization earlier; so we don't need
to spend too much time on it, but shouldn't ICE.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk/6.2?

2016-05-03  Jakub Jelinek  <ja...@redhat.com>

        PR tree-optimization/70916
        * tree-vect-patterns.c (vect_recog_mask_conversion_pattern): Give up
        if COND_EXPR rhs1 is neither SSA_NAME nor COMPARISON_CLASS_P.

        * gcc.c-torture/compile/pr70916.c: New test.

--- gcc/tree-vect-patterns.c.jj 2016-03-23 10:51:23.000000000 +0100
+++ gcc/tree-vect-patterns.c    2016-05-03 08:39:17.779229143 +0200
@@ -3673,8 +3673,10 @@ vect_recog_mask_conversion_pattern (vec<
          if (!rhs1_type)
            return NULL;
        }
-      else
+      else if (COMPARISON_CLASS_P (rhs1))
        rhs1_type = TREE_TYPE (TREE_OPERAND (rhs1, 0));
+      else
+       return NULL;
 
       vectype2 = get_mask_type_for_scalar_type (rhs1_type);
 
--- gcc/testsuite/gcc.c-torture/compile/pr70916.c.jj    2016-05-03 
09:52:28.245508879 +0200
+++ gcc/testsuite/gcc.c-torture/compile/pr70916.c       2016-05-03 
09:52:21.000000000 +0200
@@ -0,0 +1,28 @@
+/* PR tree-optimization/70916 */
+
+int a, b, c, d, i, k;
+int static *e = &b, *j;
+int **f;
+int static ***g = &f;
+int *h;
+void
+fn1 ()
+{
+  for (;;)
+    {
+      int l[1] = { };
+      int m = (__UINTPTR_TYPE__) l;
+      for (; d; d--)
+       {
+         int ****n;
+         int *****o = &n;
+         i = a & 7 ? : a;
+         *e = (((*o = &g) != (int ****) g) < h[c], 0) || k;
+         if (*e)
+           {
+             **n = &j;
+             *e = (__UINTPTR_TYPE__) h;
+           }
+       }
+    }
+}

        Jakub

Reply via email to