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: "rguenth 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 10:43:30 +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
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
AssignedTo|unassigned at gcc dot |rguenth at gcc dot gnu.org
|gnu.org |
--- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-03-14 10:43:09 UTC ---
(In reply to comment #5)
> Just swapping the order of arguments to useless_type_conversion_p works too.
> If we consider build_vector_from_val as conversion from sc's type to the inner
> type of the vector, then vectype's inner type as outer_type needs to go first:
>
> --- gcc/tree.c.jj 2011-03-11 12:16:39.000000000 +0100
> +++ gcc/tree.c 2011-03-14 10:57:21.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 (TREE_TYPE (vectype),
> + TREE_TYPE (sc)));
>
> v = VEC_alloc (constructor_elt, gc, nunits);
> for (i = 0; i < nunits; ++i)
The assert is supposed to make sure that in vectorized code vector extracts
use the correct type for assignments to scalars. Thus if we have before
vectorization
scalar = X;
and we vectorized the code that produced X we should use a vector type
for the vector result X that has an element type that is trivially
convertible to that of the above scalar. Thus, before and after
vectorization
useless_type_conversion_p (type-of-scalar, type-of-vector-element-type)
should be true. The scalar X is sc above which is trivially convertible
to scalar, so if type-of-vector-element-type is trivially convertible to
X then it's trivially convertible to scalar.
Thus the assert is correct.
I think treating restrict as ordinary qualifier in make_vector_type is
bogus, similarly not properly maintaining a ref-all "qualification".
I suppose nobody thought of pointer vector element types before.
I'll cook up a patch.