don't unconditionally cast to unsigned long
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 7 Oct 2001 11:48:15 +0000 (11:48 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 7 Oct 2001 11:48:15 +0000 (11:48 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1364 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCicode.c
src/SDCCloop.c
src/SDCCval.c

index 69c611efddb425b45ae846d8002ec13d200b3289..9e25e4367f0b7d68ed3bdc09f7e137faa595340f 100644 (file)
@@ -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) &&
index 34bb23d38653ee6f41cbdf70071f65ec4e0af00a..87523a21978a29a4c3b6e241cc0fe3dfe4b9a9d6 100644 (file)
@@ -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));
index 800f0046ee7c84fef74b049827bb2824ddb1c9a3..a9b17d639e144ca60507c3006adca4b74bd17dbf 100644 (file)
@@ -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");