* src/pic16/glue.c (pic16_printGPointerType): fixed #1207796
[fw/sdcc] / src / SDCCval.c
index 96c962a5168666fb795e20001f2d3c4ac515eb31..f1ec65ce60bf2ff311e9bbc9d9db0ba2c4ea3242 100644 (file)
@@ -120,7 +120,7 @@ convertIListToConstList(initList *src, literalList **lList)
            return FALSE;
        }
 
-       if (!IS_AST_LIT_VALUE(decorateType(resolveSymbols(iLoop->init.node), RESULT_CHECK)))
+       if (!IS_AST_LIT_VALUE(decorateType(resolveSymbols(iLoop->init.node), RESULT_TYPE_NONE)))
        {
            return FALSE;
        }
@@ -1560,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 */
@@ -1574,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)));