This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/48098] [4.6 Regression] internal compiler error: in build_vector_from_val, at tree.c:1380
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 14 Mar 2011 09:29:22 +0000
- Subject: [Bug tree-optimization/48098] [4.6 Regression] internal compiler error: in build_vector_from_val, at tree.c:1380
- Auto-submitted: auto-generated
- References: <bug-48098-4@http.gcc.gnu.org/bugzilla/>
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.