From 5824fe4da7dfff98b7bb4a2f543f040a9c0b6efe Mon Sep 17 00:00:00 2001 From: Moritz Warning Date: Sun, 1 May 2011 20:05:49 +0200 Subject: [PATCH] fixes #450 :: real inside a class breaks interface casting on x86_64; patch by prokhin_alexey --- dmd/mtype.c | 8 ++++++++ dmd/mtype.h | 3 +++ dmd2/mtype.c | 8 ++++++++ dmd2/mtype.h | 3 +++ 4 files changed, 22 insertions(+) diff --git a/dmd/mtype.c b/dmd/mtype.c index f8a96163..4f38a0fd 100644 --- a/dmd/mtype.c +++ b/dmd/mtype.c @@ -1136,6 +1136,14 @@ unsigned TypeBasic::alignsize() } +#if IN_LLVM +unsigned TypeBasic::memalign(unsigned salign) +{ + if (global.params.cpu == ARCHx86_64 && (ty == Tfloat80 || ty == Timaginary80)) + return 16; + return Type::memalign(salign); +} +#endif Expression *TypeBasic::getProperty(Loc loc, Identifier *ident) { diff --git a/dmd/mtype.h b/dmd/mtype.h index 083861e4..61ecd3d0 100644 --- a/dmd/mtype.h +++ b/dmd/mtype.h @@ -337,6 +337,9 @@ struct TypeBasic : Type Type *syntaxCopy(); d_uns64 size(Loc loc); unsigned alignsize(); +#if IN_LLVM + unsigned memalign(unsigned salign); +#endif Expression *getProperty(Loc loc, Identifier *ident); Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); char *toChars(); diff --git a/dmd2/mtype.c b/dmd2/mtype.c index bf39167a..92781758 100644 --- a/dmd2/mtype.c +++ b/dmd2/mtype.c @@ -2580,6 +2580,14 @@ unsigned TypeBasic::alignsize() #endif } +#if IN_LLVM +unsigned TypeBasic::memalign(unsigned salign) +{ + if (global.params.cpu == ARCHx86_64 && (ty == Tfloat80 || ty == Timaginary80)) + return 16; + return Type::memalign(salign); +} +#endif Expression *TypeBasic::getProperty(Loc loc, Identifier *ident) { diff --git a/dmd2/mtype.h b/dmd2/mtype.h index 488d59af..4a6846d1 100644 --- a/dmd2/mtype.h +++ b/dmd2/mtype.h @@ -400,6 +400,9 @@ struct TypeBasic : Type Type *syntaxCopy(); d_uns64 size(Loc loc); unsigned alignsize(); +#if IN_LLVM + unsigned memalign(unsigned salign); +#endif Expression *getProperty(Loc loc, Identifier *ident); Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); char *toChars();