[LLVMbugs] [Bug 20315] New: MS ABI: Layout wrong for indirectly inherited packed base

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jul 15 17:40:15 PDT 2014


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

            Bug ID: 20315
           Summary: MS ABI: Layout wrong for indirectly inherited packed
                    base
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            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

consider:
extern "C" int printf(const char *, ...);
static char buffer[419430400];
inline void *operator new(size_t, void *pv) { return pv; }
struct A {};
struct B : A {};
struct C {};
#pragma pack(push, 1)
struct D : B, virtual A, virtual C {
  int field;
  D() {
    printf("field: %d\n", (int)&field - (int)buffer);
  }
};
#pragma pack(pop)
struct E : D {};
struct F : A, E {};
template <typename Class> static void init_mem() {
  new (buffer) Class;
}
int main() {
  init_mem<F>();
}

we give:
field: 5

they give:
field: 8

-- 
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/20140716/8ad3a1ff/attachment.html>


More information about the llvm-bugs mailing list