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

* Re: Aligning struct member has strange impact on struct alignment
  2004-04-14 15:01 Aligning struct member has strange impact on struct alignment Stephan Bergmann
@ 2004-04-15 20:06 ` Jim Wilson
  0 siblings, 0 replies; 2+ messages in thread
From: Jim Wilson @ 2004-04-15 20:06 UTC (permalink / raw)
  To: Stephan Bergmann; +Cc: gcc-bugs

Stephan Bergmann wrote:
> Why is the alignment of S2 == 8 when I align its double member on 4?  Is 
> that a bug, or am I missing something?

I can reproduce this with the RHL 8 compiler which is 3.2 plus patches. 
  I can not reproduce this with gcc-3.3 or later, so it apparently has 
already been fixed.  We aren't maintaining gcc-3.2 anymore.  Only 
gcc-3.3 and on.


-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com


^ 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).