From c09b6ce975190dfef22943ffeb0502f4d217e269 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gl=C3=B6ckner?= Date: Sat, 8 Oct 2016 18:52:28 +0200 Subject: [PATCH] tccgen.c: use correct type for storing long double constants --- tccgen.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tccgen.c b/tccgen.c index c33cc81..bb10fe6 100644 --- a/tccgen.c +++ b/tccgen.c @@ -5538,7 +5538,12 @@ static void init_putv(CType *type, Section *sec, unsigned long c, *(double *)ptr = vtop->c.d; break; case VT_LDOUBLE: - *(long double *)ptr = vtop->c.ld; + if (sizeof(long double) == LDOUBLE_SIZE) + *(long double *)ptr = vtop->c.ld; + else if (sizeof(double) == LDOUBLE_SIZE) + *(double *)ptr = vtop->c.ld; + else + tcc_error("can't cross compile long double constants"); break; case VT_LLONG: *(long long *)ptr |= (vtop->c.i & bit_mask) << bit_pos;