From: kvigor Date: Thu, 21 Jun 2001 22:48:22 +0000 (+0000) Subject: bug 435068: fix this code: d = (0 ? 4 : 8) + 1; X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=a98586cdec9a03df6eaf8890e67c8ace886d6839;p=fw%2Fsdcc bug 435068: fix this code: d = (0 ? 4 : 8) + 1; git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@912 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- 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;