From a98586cdec9a03df6eaf8890e67c8ace886d6839 Mon Sep 17 00:00:00 2001 From: kvigor Date: Thu, 21 Jun 2001 22:48:22 +0000 Subject: [PATCH] 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 --- src/SDCCast.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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; -- 2.30.2