From 12984d9cc7c4d7aedc59e05249cffe58bbec1be5 Mon Sep 17 00:00:00 2001 From: Alexey Prokhin Date: Fri, 25 Feb 2011 22:28:59 +0300 Subject: [PATCH] Fix size of classes --- dmd2/class.c | 3 +++ gen/llvmhelpers.cpp | 1 + 2 files changed, 4 insertions(+) diff --git a/dmd2/class.c b/dmd2/class.c index 892cb69f..3df7d73f 100644 --- a/dmd2/class.c +++ b/dmd2/class.c @@ -737,6 +737,9 @@ void ClassDeclaration::semantic(Scope *sc) alignsize = thissize; } structsize = sc->offset; +#if IN_LLVM + structsize = (structsize + structalign - 1) & ~(structalign - 1); +#endif sizeok = 1; Module::dprogress++; diff --git a/gen/llvmhelpers.cpp b/gen/llvmhelpers.cpp index ed9d65c2..284d2894 100644 --- a/gen/llvmhelpers.cpp +++ b/gen/llvmhelpers.cpp @@ -1592,6 +1592,7 @@ size_t realignOffset(size_t offset, Type* type) // if it differs we need to insert manual padding as well if (alignsize != alignsize2) { + // FIXME: this assert fails on std.typecons //assert(alignsize > alignsize2 && "this is not good, the D and LLVM " // "type alignments differ, but LLVM's is bigger! This will break " // "aggregate type mapping");