From 3bb91c751357877458b255db0f97c3714e755f0b Mon Sep 17 00:00:00 2001 From: Alexey Prokhin Date: Fri, 25 Feb 2011 22:29:43 +0300 Subject: [PATCH] Fix alignment of structs containing real --- dmd2/mtype.c | 14 +++++++------- dmd2/struct.c | 5 ++++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/dmd2/mtype.c b/dmd2/mtype.c index 7414abcb..bf39167a 100644 --- a/dmd2/mtype.c +++ b/dmd2/mtype.c @@ -322,24 +322,24 @@ void Type::init() #endif Tsize_t = Tuns32; Tptrdiff_t = Tint32; - PTRSIZE = 4; + PTRSIZE = 4; } // set real size and padding if (global.params.cpu == ARCHx86) { - REALSIZE = 12; - REALPAD = 2; + REALSIZE = 12; + REALPAD = 2; } else if (global.params.cpu == ARCHx86_64) { - REALSIZE = 16; - REALPAD = 6; + REALSIZE = 16; + REALPAD = 6; } else { - REALSIZE = 8; - REALPAD = 0; + REALSIZE = 8; + REALPAD = 0; } } diff --git a/dmd2/struct.c b/dmd2/struct.c index c525a84c..d6a1789e 100644 --- a/dmd2/struct.c +++ b/dmd2/struct.c @@ -226,10 +226,13 @@ void AggregateDeclaration::addField(Scope *sc, VarDeclaration *v) if (!isUnionDeclaration()) sc->offset = ofs; #endif +#if !IN_LLVM if (global.params.is64bit && sc->structalign == 8 && memalignsize == 16) /* Not sure how to handle this */ ; - else if (sc->structalign < memalignsize) + else +#endif + if (sc->structalign < memalignsize) memalignsize = sc->structalign; if (alignsize < memalignsize) alignsize = memalignsize;