This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PR 6212

--On Tuesday, May 07, 2002 06:37:54 PM -0400 Richard Kenner 
<> wrote:

>     > 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         
CodeSourcery, LLC     

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]