From: sandeep Date: Sat, 10 Nov 2001 06:39:13 +0000 (+0000) Subject: Small change in valCastLiteral. I think this is a BUG in GCC convertion of X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=55d7cd1be4218fc0a7c8a1a0829adba7b46285d1;p=fw%2Fsdcc Small change in valCastLiteral. I think this is a BUG in GCC convertion of float to short was screwing up . git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1551 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/src/SDCCval.c b/src/SDCCval.c index c61a6c8c..8d65e07f 100644 --- a/src/SDCCval.c +++ b/src/SDCCval.c @@ -1414,34 +1414,30 @@ valCastLiteral (sym_link * dtype, double fval) SPEC_SCLS (val->etype) = S_LITERAL; /* if it is not a specifier then we can assume that */ /* it will be an unsigned long */ - if (!IS_SPEC (val->type)) - { + if (!IS_SPEC (val->type)) { SPEC_CVAL (val->etype).v_ulong = (unsigned long) fval; return val; - } + } if (SPEC_NOUN (val->etype) == V_FLOAT) - SPEC_CVAL (val->etype).v_float = fval; - else - { - if (SPEC_LONG (val->etype)) - { + SPEC_CVAL (val->etype).v_float = fval; + else { + unsigned long l = fval; + if (SPEC_LONG (val->etype)) { if (SPEC_USIGN (val->etype)) - SPEC_CVAL (val->etype).v_ulong = (unsigned long) fval; + SPEC_CVAL (val->etype).v_ulong = (unsigned long) l; else - SPEC_CVAL (val->etype).v_long = (long) fval; - } - else - { + SPEC_CVAL (val->etype).v_long = (long) l; + } else { if (SPEC_USIGN (val->etype)) - SPEC_CVAL (val->etype).v_uint = (unsigned short)fval; + SPEC_CVAL (val->etype).v_uint = (unsigned short)l; else - SPEC_CVAL (val->etype).v_int = (short)fval; + SPEC_CVAL (val->etype).v_int = (short)l; if (SPEC_NOUN (val->etype)==V_CHAR) { - SPEC_CVAL (val->etype).v_uint &= 0xff; + SPEC_CVAL (val->etype).v_uint &= 0xff; } - } - } + } + } return val; }