X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2FSDCCast.c;h=df6cccffaba0b7064b7d3b9211a721d5885f2fed;hb=a98586cdec9a03df6eaf8890e67c8ace886d6839;hp=1c65e5c9e8d1d76962d88487b19cb9b5ceeb07c8;hpb=49974e6371ce30581a87139d4c1e830e08153b0e;p=fw%2Fsdcc diff --git a/src/SDCCast.c b/src/SDCCast.c index 1c65e5c9..df6cccff 100644 --- a/src/SDCCast.c +++ b/src/SDCCast.c @@ -180,7 +180,6 @@ newIfxNode (ast * condAst, symbol * trueLabel, symbol * falseLabel) /* if this is a literal then we already know the result */ if (condAst->etype && IS_LITERAL (condAst->etype)) { - /* then depending on the expression value */ if (floatFromVal (condAst->opval.val)) ifxNode = newNode (GOTO, @@ -2791,8 +2790,9 @@ decorateType (ast * tree) /* conditional operator '?' */ /*----------------------------*/ case '?': - /* the type is one on the left */ - TTYPE (tree) = LTYPE (tree); + /* the type is value of the colon operator (on the right) */ + assert(IS_COLON_OP(tree->right)); + TTYPE (tree) = RTYPE(tree); // #HACK LTYPE(tree). TETYPE (tree) = getSpec (TTYPE (tree)); return tree;