]> git.gag.com Git - fw/sdcc/commitdiff
* src/SDCCval.c (cheapestVal): added missing checks
authorbernhardheld <bernhardheld@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 18 Jan 2004 21:37:55 +0000 (21:37 +0000)
committerbernhardheld <bernhardheld@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 18 Jan 2004 21:37:55 +0000 (21:37 +0000)
* src/SDCCicode.c (usualBinaryConversions): fixed condition
* src/SDCCicode.c (geniCodeAdd): fixed part of bug #877103

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3139 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
src/SDCCicode.c
src/SDCCval.c

index d974bea6421de93607269d284ec8142abc4427f4..56c038388d52c049ea953680988ee1c35e49c1af 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-01-18 Bernhard Held <bernhard@bernhardheld.de>
+
+       * src/SDCCval.c (cheapestVal): added missing checks
+       * src/SDCCicode.c (usualBinaryConversions): fixed condition
+       * src/SDCCicode.c (geniCodeAdd): fixed part of bug #877103
+
 2004-01-16 Klaus Flittner <klaus_flittner@gmx.de>
 
        * src/ds390/gen.c (aopOp3): fixed the assignment of different dptrs to
@@ -18,7 +24,7 @@
        to Pics16. Updated all references to them.
        * src/pic16/glue.c (pic16glue): corrected bug with code
        initialization which bypassed the variable initializations block.
-       
+
        * device/lib/pic16/Makefile.rules: removed --penable-stack from
        COMPILE_FLAGS and added the --nostdinc option
 
        files into pic16 directory
        * in target 'installdirs' added line to create directory pic16 in
        the installation path
-       
+
        * device/include/Makefile.in (version 1.11): in target 'install'
        added lines to copy all header files to installation path,
        * in target 'installdirs' added line create directory for pic16
-       headers in the installation path 
+       headers in the installation path
 
 2004-01-13 Klaus Flittner <klaus_flittner@gmx.de>
 
index f19f4129f48eae18aec872701de1bb8fa67f158b..8671e2ad369eeaecb5be1be3493966a6fd0ef30f 100644 (file)
@@ -1764,12 +1764,19 @@ usualBinaryConversions (operand ** op1, operand ** op2,
      This if for 'mul a,b', which takes two chars and returns an int */
   if (   isMul
       /* && promoteCharToInt   superfluous, already handled by computeType() */
-      && IS_CHAR (getSpec (ltype))
-      && IS_CHAR (getSpec (rtype))
-      && !(IS_UNSIGNED (getSpec (rtype)) ^ IS_UNSIGNED (getSpec (ltype)))
       && IS_INT  (getSpec (ctype)))
-    return ctype;
+    {
+      sym_link *retype = getSpec (rtype);
+      sym_link *letype = getSpec (ltype);
 
+      if (   IS_CHAR (letype)
+         && IS_CHAR (retype)
+         && IS_UNSIGNED (letype)
+         && IS_UNSIGNED (retype))
+       {
+         return ctype;
+       }
+    }
   *op1 = geniCodeCast (ctype, *op1, TRUE);
   *op2 = geniCodeCast (ctype, *op2, TRUE);
 
@@ -2216,6 +2223,7 @@ geniCodeAdd (operand * left, operand * right, int lvl)
       if (getSize (ltype->next) != 1)
         {
          size  = operandFromLit (getSize (ltype->next));
+         SPEC_USIGN (getSpec (operandType (size))) = 1;
          indexUnsigned = IS_UNSIGNED (getSpec (operandType (right)));
          right = geniCodeMultiply (right, size, (getArraySizePtr(left) >= INTSIZE));
          /* Even if right is a 'unsigned char',
@@ -3778,7 +3786,7 @@ ast2iCode (ast * tree,int lvl)
        return geniCodeDerefPtr (geniCodeRValue (left, FALSE),lvl);
 
     case '-':
-      if (right) 
+      if (right)
        return geniCodeSubtract (geniCodeRValue (left, FALSE),
                                 geniCodeRValue (right, FALSE));
       else
index 7657be6b206e6fb01b703ba5b174a0b38213aae8..6d1e5cc91c0c9e6fda22157e8dd7f9f88d72d881 100644 (file)
@@ -374,6 +374,9 @@ static value *cheapestVal (value *val) {
 
 static value *cheapestVal (value *val)
 {
+  if (IS_FLOAT (val->type) || IS_CHAR (val->type))
+    return val;
+
   /* - signed/unsigned must not be changed.
      - long must not be changed.