tccgen.c: use correct type for storing long double constants

This commit is contained in:
Daniel Glöckner 2016-10-08 18:52:28 +02:00
parent 3dfee1d290
commit c09b6ce975

View File

@ -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;