fixed bug #486483
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 19 Dec 2001 14:36:32 +0000 (14:36 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 19 Dec 2001 14:36:32 +0000 (14:36 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1716 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/pic/gen.c
src/z80/gen.c

index 78091f79b5e381d1daeef0093699378c91a1c2a5..c8a8fc64f686c5d0aad6f521e8a0ab6cf3c4f5f0 100644 (file)
@@ -8818,6 +8818,7 @@ static void genCast (iCode *ic)
 {
     operand *result = IC_RESULT(ic);
     sym_link *ctype = operandType(IC_LEFT(ic));
+    sym_link *rtype = operandType(IC_RIGHT(ic));
     operand *right = IC_RIGHT(ic);
     int size, offset ;
 
@@ -9013,7 +9014,7 @@ static void genCast (iCode *ic)
     /* now depending on the sign of the destination */
     size = AOP_SIZE(result) - AOP_SIZE(right);
     /* if unsigned or not an integral type */
-    if (SPEC_USIGN(ctype) || !IS_SPEC(ctype)) {
+    if (SPEC_USIGN(rtype) || !IS_SPEC(rtype)) {
       while (size--)
        emitpcode(POC_CLRF,   popGet(AOP(result),offset++));
     } else {
index 1ac58abf97b3b3da1baf7cb53cf2766f53c449d5..b63138c04055158353746e5f4a62fe0e3d0be3f9 100644 (file)
@@ -6546,7 +6546,7 @@ static void
 genCast (iCode * ic)
 {
   operand *result = IC_RESULT (ic);
-  sym_link *ctype = operandType (IC_LEFT (ic));
+  sym_link *rtype = operandType (IC_RIGHT (ic));
   operand *right = IC_RIGHT (ic);
   int size, offset;
 
@@ -6600,7 +6600,7 @@ genCast (iCode * ic)
   /* now depending on the sign of the destination */
   size = AOP_SIZE (result) - AOP_SIZE (right);
   /* Unsigned or not an integral type - right fill with zeros */
-  if (SPEC_USIGN (ctype) || !IS_SPEC (ctype))
+  if (SPEC_USIGN (rtype) || !IS_SPEC (rtype) || AOP_TYPE(right)==AOP_CRY)
     {
       while (size--)
        aopPut (AOP (result), "!zero", offset++);