Small fix for implicit integral promotion
[fw/sdcc] / src / SDCCast.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