* src/SDCCast.c (decorateType): fixed char foo (unsigned long ul) { return ul > 0; }
authorbernhardheld <bernhardheld@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 11 Jan 2004 21:58:32 +0000 (21:58 +0000)
committerbernhardheld <bernhardheld@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 11 Jan 2004 21:58:32 +0000 (21:58 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3116 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
src/SDCCast.c

index 03476aac97a7e8ab87e787e453e07c3364268678..0d8dd80938b94382b498296dfc74d3c360d69e3b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
 2004-01-11 Bernhard Held <bernhard@bernhardheld.de>
 
        * src/SDCCicode.c (operandOperation): fixed bug #874819
+       * src/SDCCast.c (decorateType): fixed
+       char foo (unsigned long ul) { return ul > 0; }
 
 2004-01-11 Frieder Ferlemann <Frieder.Ferlemann@web.de>
 
index 9944eb407736217f94da4d98f6533c0c194cd5de..c1ed4b049dfad603e6f80d14a4a64c518d0c6539 100644 (file)
@@ -1746,7 +1746,7 @@ isConformingBody (ast * pbody, symbol * sym, ast * body)
     case '?':
     case ':':
     case SIZEOF:               /* evaluate wihout code generation */
-      
+
       if (IS_AST_SYM_VALUE (pbody->left) &&
          isSymbolEqual (AST_SYMBOL (pbody->left), sym))
        return FALSE;
@@ -3478,7 +3478,7 @@ decorateType (ast * tree)
              }
        }
       /* if unsigned value < 0  then always false */
-      /* if (unsigned value) > 0 then (unsigned value) */
+      /* if (unsigned value) > 0 then '(unsigned value) ? 1 : 0' */
       if (SPEC_USIGN(LETYPE(tree)) && IS_LITERAL(RTYPE(tree))  &&
          ((int) floatFromVal (valFromType (RETYPE (tree)))) == 0)
        {
@@ -3488,7 +3488,13 @@ decorateType (ast * tree)
            }
          if (tree->opval.op == '>')
            {
-             return tree->left;
+             tree->opval.op = '?';
+             tree->right = newNode (':',
+                                    newAst_VALUE (constVal ("1")),
+                                    tree->right); /* val 0 */
+             tree->right->lineno = tree->lineno;
+             tree->right->left->lineno = tree->lineno;
+             decorateType (tree->right);
            }
         }
       /* if they are both literal then */