[LLVMbugs] [Bug 18513] New: clang generates layout incompatible with gcc and icc

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jan 16 15:25:59 PST 2014


            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: unassignedclangbugs at nondot.org
          Reporter: david.majnemer at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140116/ad28e6a3/attachment.html>

More information about the llvm-bugs mailing list