public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c/9932: alignment of 64-bit type in struct seems to be wrong
@ 2003-03-04 4:06 hagen
0 siblings, 0 replies; only message in thread
From: hagen @ 2003-03-04 4:06 UTC (permalink / raw)
To: gcc-gnats
>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:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-03-04 4:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-04 4:06 c/9932: alignment of 64-bit type in struct seems to be wrong hagen
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).