This is the mail archive of the
mailing list for the GCC project.
Re: PR 6212
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>, "rth at redhat dot com" <rth at redhat dot com>
- Cc: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Tue, 07 May 2002 20:01:57 -0700
- Subject: Re: PR 6212
- References: <10205072237.AA00255@vlsi1.ultra.nyu.edu>
--On Tuesday, May 07, 2002 06:37:54 PM -0400 Richard Kenner
> > Say you have an object whose type is 1-byte integer
> > with a user-specifed alignment of 32 bits. What do you do?
> new = build_type_copy (char_type_node);
> TYPE_ALIGN (new) = 32;
> I don't believe we support such a thing.
> Why are you creating a record type? Surely that's the pain
> you're saying you'll have converting to and from the new type.
> Why create *any* extra type? Even if the above can be made to work, why
> have the conversions?
This is a language question as much as an implementation question. If
these things have different types, then you have to decide what all the
conversion rules are. On the other hand, saying that two things that
have the same type have different sizes is just plain wrong.
Therefore, I agree with Richard Henderson.
Types are where this information should go.
DECL_SIZE/DECL_ALIGN are just plain wrong, and should be eliminated.
Using types gives you a way to provide feedback about possibly invalid
conversions, like converting a pointer to a byte-aligned int to a pointer
to a word-aligned int. The usual type theoretic rules would imply
you cannot go that way, but you can go the other way. This is the
whole point of a type system.
Mark Mitchell firstname.lastname@example.org
CodeSourcery, LLC http://www.codesourcery.com