This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Disallow VECTOR_CSTs with missing elements
On Thu, Jul 29, 2010 at 2:42 PM, Nathan Froyd <firstname.lastname@example.org> wrote:
> On Thu, Jul 29, 2010 at 12:39:18PM +0200, Richard Guenther wrote:
>> The user can happily provide not enough elements for the initializer
>> of a vector variable which eventually leads to build_vector_from_ctor
>> constructing a VECTOR_CST with an element count that does not match
>> TYPE_VECTOR_SUBPARTS. ?Not a good thing to have in our IL (and nothing
>> existing code expects).
> Could you add tree verification code to enforce this?
> Does this imply that having TREE_VECTOR_CST_ELTS be NULL is invalid?
> There's a lot of code in the middle-end and backends (sparc comes
> immediately to mind) that is needlessly complex because it checks for
> NULL TREE_VECTOR_CST_ELTS. ?If such a state is indeed invalid, it would
> simplify things immensely.
Well, I'd say the representation for VECTOR_CST using a tree list of
elements is broken anyway. If somebody would spend the time to
convert it to something sane, like having embedded elements
(or do we want VECs these days? or TREE_VECs in trees?)
that would be nice.
I can add code to the verifier though (though the assert in the
only code that makes a VECTOR_CST node looks good enough
to me). So yes, a NULL_TREE TREE_VECTOR_CST_ELTS isn't