This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/52023] _Alignof (double) yields wrong value on x86
- From: "eggert at gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 27 Jan 2012 22:13:13 +0000
- Subject: [Bug target/52023] _Alignof (double) yields wrong value on x86
- Auto-submitted: auto-generated
- References: <bug-52023-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023
eggert at gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|DUPLICATE |
--- Comment #8 from eggert at gnu dot org 2012-01-27 22:13:13 UTC ---
> What happens if you have the attribute packed on the structure?
That's not relevant to the standard conformance issue.
Any program that uses __attribute__((packed)) is not a C11 program,
and for such programs C11 does not specify what alignof(double) returns.
The most useful thing for alignof to return is the value that it would return
ignoring the presence of 'packed', as that makes its behavior
simpler and more consistent. Most likely, if a future version of
C11 specifies structure packing, it'll specify precisely this behavior
for alignof, as it wouldn't be useful to have alignof(X) always return 1.
For strict C11 programs, though, _Alignof(double) cannot return 8 on x86 hosts,
because GCC sometimes allocate 'double' objects on boundaries that
are merely multiples of 4. The test programs in comment#1 are strict
C11 programs and illustrate the conformance bug.