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

            Bug ID: 18513
           Summary: clang generates layout incompatible with gcc and icc
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

consider:
typedef __SIZE_TYPE__ size_t;
extern "C" int printf(const char *, ...);
static char buffer[419430400];
inline void *operator new(size_t, void *pv) { return pv; }
struct A {
  __attribute__((aligned(32))) bool AField;
  A() {}
};
struct B : A {
  __attribute__((aligned(16))) long long : 1;
  bool BField;
  B() {
    printf("BField: %ld\n", (long)((char *)&BField - buffer));
  }
};
int main() { new (buffer) B; }

gcc and icc give:
BField: 17

clang gives:
BField: 2

-- 
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