* doc/Makefile,
[fw/sdcc] / src / SDCCval.c
index b2f8fe0e1b0cf4db8434243e7c9913409bb91067..69aab095c2031230256e3436672010820f19a5aa 100644 (file)
@@ -1044,6 +1044,10 @@ valComplement (value * val)
        SPEC_CVAL (val->etype).v_uint = ~SPEC_CVAL (val->etype).v_uint;
       else
        SPEC_CVAL (val->etype).v_int = ~SPEC_CVAL (val->etype).v_int;
+      if (SPEC_NOUN(val->etype) == V_CHAR)
+        if (   SPEC_CVAL(val->etype).v_int < -128
+            || SPEC_CVAL(val->etype).v_int >  127)
+          SPEC_NOUN(val->etype) = V_INT;
     }
   // ~(unsigned 3) now really is signed
   SPEC_USIGN(val->etype)=0;
@@ -1556,7 +1560,13 @@ valCastLiteral (sym_link * dtype, double fval)
     return NULL;
 
   val = newValue ();
-  val->etype = getSpec (val->type = copyLinkChain (dtype));
+  if (dtype)
+    val->etype = getSpec (val->type = copyLinkChain (dtype));
+  else
+    {
+      val->etype = val->type = newLink (SPECIFIER);
+      SPEC_NOUN (val->etype) = V_VOID;
+    }
   SPEC_SCLS (val->etype) = S_LITERAL;
 
   /* if it is not a specifier then we can assume that */
@@ -1570,7 +1580,7 @@ valCastLiteral (sym_link * dtype, double fval)
       SPEC_CVAL (val->etype).v_float = fval;
   else if (SPEC_NOUN (val->etype) == V_BIT ||
            SPEC_NOUN (val->etype) == V_SBIT)
-    SPEC_CVAL (val->etype).v_uint = l & 1;   
+    SPEC_CVAL (val->etype).v_uint = l ? 1 : 0;
   else if (SPEC_NOUN (val->etype) == V_BITFIELD)
     SPEC_CVAL (val->etype).v_uint = l &
                                    (0xffffu >> (16 - SPEC_BLEN (val->etype)));
@@ -1695,7 +1705,7 @@ valForArray (ast * arrExpr)
     DCL_TYPE (val->type) = EEPPOINTER;
   else
     DCL_TYPE (val->type) = POINTER;
-  val->type->next = arrExpr->left->ftype;
+  val->type->next = arrExpr->left->ftype->next;
   val->etype = getSpec (val->type);
   return val;
 }