From: johanknol Date: Sun, 7 Oct 2001 11:48:15 +0000 (+0000) Subject: don't unconditionally cast to unsigned long X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=0299234dcc9718e0017d8a1a2d04c6b64220af2c;p=fw%2Fsdcc don't unconditionally cast to unsigned long git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1364 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/src/SDCCicode.c b/src/SDCCicode.c index 69c611ef..9e25e436 100644 --- a/src/SDCCicode.c +++ b/src/SDCCicode.c @@ -965,20 +965,20 @@ operandOperation (operand * left, operand * right, break; case LEFT_OP: - retval = operandFromLit (((SPEC_USIGN(let) ? + retval = operandFromLit ((SPEC_USIGN(let) ? (unsigned long) operandLitValue (left) : (long) operandLitValue (left)) << (SPEC_USIGN(ret) ? (unsigned long) operandLitValue (right) : - (long) operandLitValue (right)))); + (long) operandLitValue (right))); break; case RIGHT_OP: - retval = operandFromLit (((SPEC_USIGN(let) ? + retval = operandFromLit ((SPEC_USIGN(let) ? (unsigned long) operandLitValue (left) : (long) operandLitValue (left)) >> (SPEC_USIGN(ret) ? (unsigned long) operandLitValue (right) : - (long) operandLitValue (right)))); + (long) operandLitValue (right))); break; case EQ_OP: retval = operandFromLit (operandLitValue (left) == @@ -1005,16 +1005,28 @@ operandOperation (operand * left, operand * right, operandLitValue (right)); break; case BITWISEAND: - retval = operandFromLit ((unsigned long) operandLitValue (left) & - (unsigned long) operandLitValue (right)); + retval = operandFromLit ((SPEC_USIGN(let) ? + (unsigned long) operandLitValue (left) : + (long) operandLitValue (left)) & + (SPEC_USIGN(ret) ? + (unsigned long) operandLitValue (right) : + (long) operandLitValue (right))); break; case '|': - retval = operandFromLit ((unsigned long) operandLitValue (left) | - (unsigned long) operandLitValue (right)); + retval = operandFromLit ((SPEC_USIGN(let) ? + (unsigned long) operandLitValue (left) : + (long) operandLitValue (left)) | + (SPEC_USIGN(ret) ? + (unsigned long) operandLitValue (right) : + (long) operandLitValue (right))); break; case '^': - retval = operandFromLit ((unsigned long) operandLitValue (left) ^ - (unsigned long) operandLitValue (right)); + retval = operandFromLit ((SPEC_USIGN(let) ? + (unsigned long) operandLitValue (left) : + (long) operandLitValue (left)) ^ + (SPEC_USIGN(ret) ? + (unsigned long) operandLitValue (right) : + (long) operandLitValue (right))); break; case AND_OP: retval = operandFromLit (operandLitValue (left) && diff --git a/src/SDCCloop.c b/src/SDCCloop.c index 34bb23d3..87523a21 100644 --- a/src/SDCCloop.c +++ b/src/SDCCloop.c @@ -798,12 +798,12 @@ basicInduction (region * loopReg, eBBlock ** ebbs, int count) OP_SYMBOL (IC_RESULT (indIc))->isind = 1; ip = newInduction (IC_RIGHT (ic), dic->op, litValue, indIc, NULL); - if (1) { + if (0) { fprintf (stderr, "%s:%d: stupid way to avoid bug #467035, but\n" "this will keep the regressions tests going.\n", __FILE__, __LINE__); continue; - } + } continue; /* replace the inducted variable by the iTemp */ replaceSymBySym (loopReg->regBlocks, IC_RESULT (ic), IC_RIGHT (ic)); diff --git a/src/SDCCval.c b/src/SDCCval.c index 800f0046..a9b17d63 100644 --- a/src/SDCCval.c +++ b/src/SDCCval.c @@ -394,9 +394,9 @@ value * constFloatVal (char *s) { value *val = newValue (); - float sval; + double sval; - if (sscanf (s, "%f", &sval) != 1) + if (sscanf (s, "%lf", &sval) != 1) { werror (E_INVALID_FLOAT_CONST, s); return constVal ("0");