This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/14142] New: attribute(aligned())) has no effect with typedef's
- From: "gp at qnx dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Feb 2004 19:59:20 -0000
- Subject: [Bug c/14142] New: attribute(aligned())) has no effect with typedef's
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Consider:
#include <stddef.h>
typedef unsigned long long _Uint64t __attribute__((__aligned__(8)));
typedef struct
{
unsigned int a;
_Uint64t b __attribute__((__aligned__(8)));
} my_aligned_struct;
typedef struct
{
unsigned int a;
_Uint64t b;
} my_struct;
int main(int argc, char ** argv)
{
printf("offset of b : %d\n", offsetof(my_aligned_struct,b));
printf("offset of b : %d\n", offsetof(my_struct,b));
return 0;
}
The offset of 'b' should be 8 in both cases, but it is 4 when the attribute
aligned is only applied to the typedef (using gcc-3.3.3 prerelease Feb 10 2004).
--
Summary: attribute(aligned())) has no effect with typedef's
Product: gcc
Version: 3.3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gp at qnx dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14142