Small fix for implicit integral promotion
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 5 Jan 2003 16:38:49 +0000 (16:38 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 5 Jan 2003 16:38:49 +0000 (16:38 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2136 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCast.c
src/SDCCsymt.c

index f8d5e58caef7be71c5718b8977d2943f4097f1df..fa103570fadcd57cd9983e3745e4d4151ebb3cdc 100644 (file)
@@ -1977,7 +1977,8 @@ decorateType (ast * tree)
        (getSize(LTYPE(tree)) > getSize(RTYPE(tree))) &&
        (getSize(RTYPE(tree)) < INTSIZE)) {
       // this is a cast/assign to a bigger type
-      if (IS_AST_OP(tree->right) && 
+      if (IS_AST_OP(tree->right) &&
+         IS_INTEGRAL(tree->right->ftype) &&
          (tree->right->opval.op == LEFT_OP ||
           tree->right->opval.op == '*' ||
           tree->right->opval.op == '+' ||
@@ -2501,7 +2502,7 @@ decorateType (ast * tree)
 
       LRVAL (tree) = RRVAL (tree) = 1;
       /* if the left is a pointer */
-      if (IS_PTR (LTYPE (tree)) || IS_ARRAY (LTYPE (tree)))
+      if (IS_PTR (LTYPE (tree)) || IS_AGGREGATE (LTYPE (tree)) )
        TETYPE (tree) = getSpec (TTYPE (tree) =
                                 LTYPE (tree));
       else
index 2721c1d8d9f3c00269ad959f24f960a65457469f..20ee30adcab89f68e804eb10fa79a439d9f49173 100644 (file)
@@ -2030,7 +2030,11 @@ printTypeChain (sym_link * start, FILE * of)
              fprintf (of, "unkown * ");
              break;
            case ARRAY:
-             fprintf (of, "[] ");
+             if (DCL_ELEM(type)) {
+               fprintf (of, "[%d] ", DCL_ELEM(type));
+             } else {
+               fprintf (of, "[] ");
+             }
              break;
            }
        }