This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/14142] New: attribute(aligned())) has no effect with typedef's


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]