http://llvm.org/bugs/show_bug.cgi?id=12148

             Bug #: 12148
           Summary: alignment (via attribute) of base class ignored
           Product: clang
           Version: 3.0
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]
    Classification: Unclassified


The following testcase does not work as expected (can't argue with a standard
other than GCC behavior here):

struct AlignedBase {
} __attribute__((aligned(16)));

struct A : public AlignedBase {
    int data[16];
};

void *foo()
{
    A a;
    return &a.data[0];
}

GCC will ensure that A is aligned to 16 Bytes. With clang I get the following:
0000000000000000 <foo()>:
   0:   48 8d 44 24 c0          lea    -0x40(%rsp),%rax
   5:   c3                      retq

Since %rsp is a multiple of 16 + 8 on x86_64 this code would be incorrect.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to