http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48098

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-03-14 
09:29:02 UTC ---
Smaller testcase:

void
foo (int n)
{
  static char *__restrict *p;
  int i;
  p = __builtin_malloc (n);
  for (i = 0; i < n; i++)
    p[i] = 0;
}

The reason why the conversion between char * types isn't useless is that one of
the pointers is TYPE_RESTRICT, while the other one is not.

--- gcc/tree.c.jj    2011-03-11 12:16:39.000000000 +0100
+++ gcc/tree.c    2011-03-14 10:27:25.000000000 +0100
@@ -1376,8 +1376,8 @@ build_vector_from_val (tree vectype, tre
   if (sc == error_mark_node)
     return sc;

-  gcc_assert (useless_type_conversion_p (TREE_TYPE (sc),
-                     TREE_TYPE (vectype)));
+  gcc_assert (useless_type_conversion_p (TYPE_MAIN_VARIANT (TREE_TYPE (sc)),
+                     TYPE_MAIN_VARIANT (TREE_TYPE (vectype))));

   v = VEC_alloc (constructor_elt, gc, nunits);
   for (i = 0; i < nunits; ++i)

fixes the ICE, but I wonder whether it isn't instead a bug in the vectorizer.

Reply via email to