bug 435068: fix this code: d = (0 ? 4 : 8) + 1;
authorkvigor <kvigor@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 21 Jun 2001 22:48:22 +0000 (22:48 +0000)
committerkvigor <kvigor@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 21 Jun 2001 22:48:22 +0000 (22:48 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@912 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCast.c

index 1c65e5c9e8d1d76962d88487b19cb9b5ceeb07c8..df6cccffaba0b7064b7d3b9211a721d5885f2fed 100644 (file)
@@ -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;