public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: Stephan Bergmann <stephan.bergmann@sun.com>
To: gcc-bugs@gcc.gnu.org
Subject: Aligning struct member has strange impact on struct alignment
Date: Wed, 14 Apr 2004 15:01:00 -0000	[thread overview]
Message-ID: <407D41E8.9000202@sun.com> (raw)

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


             reply	other threads:[~2004-04-14 13:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-14 15:01 Stephan Bergmann [this message]
2004-04-15 20:06 ` Jim Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=407D41E8.9000202@sun.com \
    --to=stephan.bergmann@sun.com \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).