X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2FSDCCval.c;h=d893ccba608a3a902fbe64b934858e0cd78eb62e;hb=d8be5b9eef951edcd88af05a6800d46fffed9582;hp=e861392109534e828725b1876aff65189ed4483f;hpb=6debd5bce497b8fda011030faa8749b6cff49aab;p=fw%2Fsdcc diff --git a/src/SDCCval.c b/src/SDCCval.c index e8613921..d893ccba 100644 --- a/src/SDCCval.c +++ b/src/SDCCval.c @@ -946,6 +946,12 @@ valUnaryPM (value * val) } // -(unsigned 3) now really is signed SPEC_USIGN(val->etype)=0; + // -(unsigned char)135 now really is an int + if (SPEC_NOUN(val->etype) == V_CHAR) { + if (SPEC_CVAL(val->etype).v_int < -128) { + SPEC_NOUN(val->etype) = V_INT; + } + } return val; } @@ -1451,7 +1457,6 @@ valCastLiteral (sym_link * dtype, double fval) int getNelements (sym_link * type, initList * ilist) { - sym_link *etype = getSpec (type); int i; if (!ilist) @@ -1462,7 +1467,7 @@ getNelements (sym_link * type, initList * ilist) /* 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); @@ -1485,7 +1490,6 @@ getNelements (sym_link * type, initList * ilist) i++; ilist = ilist->next; } - return i; }