public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: hagen@equator.com To: gcc-gnats@gcc.gnu.org Subject: c/9932: alignment of 64-bit type in struct seems to be wrong Date: Tue, 04 Mar 2003 04:06:00 -0000 [thread overview] Message-ID: <20030304035806.8252.qmail@sources.redhat.com> (raw) >Number: 9932 >Category: c >Synopsis: alignment of 64-bit type in struct seems to be wrong >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Tue Mar 04 04:06:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: Hagen >Release: gcc version 2.96 20000731 (Red Hat Linux 7.2 2.96-112.7.2) >Organization: >Environment: redhat linux 7.2 running on Dell P4 >Description: The following code generates different sizes for the two types test1 and tes2 (12 for test1 and 16 for test2): #include <stdio.h> typedef unsigned long long UInt64; typedef struct { int a; UInt64 l; } test1; typedef struct { int a; UInt64 l __attribute__((aligned(8))); } test2; int main(void) { printf("%d %d\n", sizeof(test1), sizeof(test2)); printf("%d %d %d\n", __alignof(test1), __alignof(test2), __alignof(UInt64)); } Since the alignment of UInt64 seems to be 8 bytes I would also expect type test1 to be of the size 16 (and have the alignment 8). >How-To-Repeat: compile the code: e.g. gcc test.c run the resulting a.out and the result is: 12 16 4 8 8 >Fix: >Release-Note: >Audit-Trail: >Unformatted:
reply other threads:[~2003-03-04 4:06 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20030304035806.8252.qmail@sources.redhat.com \ --to=hagen@equator.com \ --cc=gcc-gnats@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: linkBe 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).