public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* Aligning struct member has strange impact on struct alignment
@ 2004-04-14 15:01 Stephan Bergmann
2004-04-15 20:06 ` Jim Wilson
0 siblings, 1 reply; 2+ messages in thread
From: Stephan Bergmann @ 2004-04-14 15:01 UTC (permalink / raw)
To: gcc-bugs
Hi all.
I have a strange effect with gcc 3.2.2 on Linux x86, where the C program
#include <stdio.h>
struct S1 { double m; };
struct S2 { double m __attribute__((aligned(4))); };
int main(void) {
printf(
"__alignof__(S1) = %d\n__alignof__(S2) = %d\n",
__alignof__(struct S1), __alignof__(struct S2));
}
prints
__alignof__(S1) = 4
__alignof__(S2) = 8
Why is the alignment of S2 == 8 when I align its double member on 4? Is
that a bug, or am I missing something?
-Stephan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-04-15 19:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-14 15:01 Aligning struct member has strange impact on struct alignment Stephan Bergmann
2004-04-15 20:06 ` Jim Wilson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).