[cfe-commits] [PATCH] Fix __alignof__ behavior with a field as the operand

Anders Carlsson andersca at mac.com
Mon Feb 22 20:40:04 PST 2010


22 feb 2010 kl. 20.37 skrev Charles Davis:

> This patch fixes __alignof__ to behave the same as GCC when a reference
> to a field of a struct is the operand. This fixes PR6362.
> 
> GCC returns the lesser of the alignment of the type of the field or the
> packed alignment of the struct in this situation. Right now, clang just
> returns the alignment of the type, no matter what. This means that the
> behavior of clang deviates from GCC when a field of a packed struct
> (i.e. one with the 'packed' attribute or one declared after a pack
> pragma) is the operand.
> 
> Software in the wild (e.g., Wine) already depends on this behavior.
> 
> This is a simple patch, but I wanted to run it past you guys before
> committing.
> 

Hi Charles,

patch looks good. I assume all tests pass? :)

> +      // In the case of a field in a packed struct, we want the MINIMUM

No need to shout here :), plz change to "minimum".

Anders
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100222/db4f1c83/attachment.html>


More information about the cfe-commits mailing list