[LLVMbugs] [Bug 17761] New: [-cxx-abi microsoft] Bad layout of non-empty class hierarchy

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Oct 31 12:40:34 PDT 2013


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

            Bug ID: 17761
           Summary: [-cxx-abi microsoft] Bad layout of non-empty class
                    hierarchy
           Product: clang
           Version: trunk
          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

take the following:

#include <stddef.h>
#include <stdio.h>
#include <string.h>
char buffer[419430400];
inline void *operator new(size_t, void *pv) { return pv; }
struct TypeName0 {
    long long TypeName0FieldName7;
    TypeName0() {
        printf("%llu\n", (unsigned long long)((size_t)this - (size_t)buffer));
        printf("%llu\n", (unsigned long long)((size_t)&TypeName0FieldName7 -
(size_t)buffer));
    }
};
struct TypeName2 {
    TypeName0 TypeName2FieldName30;
    TypeName2() {
        printf("%llu\n", (unsigned long long)((size_t)this - (size_t)buffer));
        printf("%llu\n", (unsigned long long)((size_t)&TypeName2FieldName30 -
(size_t)buffer));
    }
};
struct TypeName12: public TypeName0 {
    TypeName2 TypeName12FieldName0;
    TypeName12() {
        printf("%llu\n", (unsigned long long)((size_t)this - (size_t)buffer));
        printf("%llu\n", (unsigned long long)((size_t)&TypeName12FieldName0 -
(size_t)buffer));
    }
};
struct TypeName20: public TypeName0, public virtual TypeName12 {
    TypeName0 TypeName20FieldName20;

    int TypeName20FieldName31;
    bool : 3;
    TypeName20() {
        printf("%llu\n", (unsigned long long)((size_t)this - (size_t)buffer));
        printf("%llu\n", (unsigned long long)((size_t)&TypeName20FieldName20 -
(size_t)buffer));
        printf("%llu\n", (unsigned long long)((size_t)&TypeName20FieldName31 -
(size_t)buffer));
    }
};
int main() {
    memset(buffer, 0, sizeof(buffer));
    new (buffer) TypeName20;
}


we produce:
32
32
40
40
40
40
32
40
0
0
16
16
0
16
24

cl produces:
40
40
48
48
48
48
40
48
0
0
16
16
0
16
24

-- 
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/20131031/ae6b9caf/attachment.html>


More information about the llvm-bugs mailing list