* src/SDCCsymt.c (initCSupport): fix compile warning on Cygwin
[fw/sdcc] / src / SDCCval.c
index 72c73a1888cc1d7e21dc2dfc1ed413326f2686c6..ca06659834f6c6a070dff2a73a35fd1fef766f98 100644 (file)
@@ -1309,7 +1309,8 @@ valBitwise (value * lval, value * rval, int op)
 
   /* create a new value */
   val = newValue ();
-  val->type = copyLinkChain (lval->type);
+  val->type = copyLinkChain (getSize(rval->type) > getSize(lval->type) ?
+                            rval->type : lval->type);
   val->etype = getSpec (val->type);
 
   switch (op)
@@ -1457,18 +1458,17 @@ valCastLiteral (sym_link * dtype, double fval)
 int 
 getNelements (sym_link * type, initList * ilist)
 {
-  sym_link *etype = getSpec (type);
   int i;
 
   if (!ilist)
     return 0;
 
-  while (ilist->type == INIT_DEEP)
+  if (ilist->type == INIT_DEEP)
     ilist = ilist->init.deep;
 
   /* if type is a character array and there is only one
      (string) initialiser then get the length of the string */
-  if (IS_ARRAY (type) && IS_CHAR (etype) && !ilist->next)
+  if (IS_ARRAY (type) && IS_CHAR (type->next) && !ilist->next)
     {
       ast *iast = ilist->init.node;
       value *v = (iast->type == EX_VALUE ? iast->opval.val : NULL);
@@ -1491,7 +1491,6 @@ getNelements (sym_link * type, initList * ilist)
       i++;
       ilist = ilist->next;
     }
-
   return i;
 }