DATA_ALIGNMENT vs. DECL_USER_ALIGNMENT

Alexandre Oliva aoliva@redhat.com
Thu Apr 17 20:16:00 GMT 2003


On Apr 17, 2003, kenner@vlsi1.ultra.nyu.edu (Richard Kenner) wrote:

>     Well...  You can always compare DECL_USER_ALIGN with TYPE_USER_ALIGN,
>     if you care strongly about that.  

> No, you can't.  You can't distinguish between the cases where the alignment
> is specified for the type and not the object and the case where it is
> specified for both.

I still don't see why it would make a difference, and why it can
possibly be correct to do anything different.

>     But the point that whether the alignment came from a decl-specific
>     attribute or from the type shouldn't make a difference.

> Why not?  They are two *very* different things with different semantics.

I don't see the difference.  To me, applying the align attribute to a
type has always been equivalent to applying the same attribute to all
declarations of that type, except those that override it with
something different.

>     But why should the common case be more difficult and error-prone?  

> Which is "the common case"?

Have the alignment specified for only one of them, and most likely to
types, which means (to me) that it applies to all declarations of that
type.

> Specifying alignment in Ada is much more common and there the most
> common case is specifying it for types and not for objects.

So we're in agreement on this point.

>     Do you have any situation in mind in which it is actually important to
>     tell whether a decl-specific user-requested alignment came from the
>     variable declaration or from its type?

> Sure.  It's required to properly implement these specifications for
> Ada, where the semantics of the two cases are completely different.

Ok, you got me curious.  Would you mind explaining to an Ada-clueless
person how come these two cases can possibly be different?  In my
C-centric view, I really can't see the difference.  Code snippets
demonstrating the semantic difference would be highly appreciated.

Waiting to be enlightened, :-)

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer



More information about the Gcc-patches mailing list