From 7ebfb4a2306b9fea07e0bd6c329d73558d63728d Mon Sep 17 00:00:00 2001 From: sandeep Date: Mon, 19 Jun 2000 15:50:50 +0000 Subject: [PATCH] fixed sign extension bug git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@280 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/mcs51/gen.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/mcs51/gen.c b/src/mcs51/gen.c index 602ffba0..d26aa0c8 100644 --- a/src/mcs51/gen.c +++ b/src/mcs51/gen.c @@ -7153,6 +7153,7 @@ static void genCast (iCode *ic) { operand *result = IC_RESULT(ic); link *ctype = operandType(IC_LEFT(ic)); + link *rtype = operandType(IC_RIGHT(ic)); operand *right = IC_RIGHT(ic); int size, offset ; @@ -7225,20 +7226,6 @@ static void genCast (iCode *ic) else { /* we have to go by the storage class */ p_type = PTR_TYPE(SPEC_OCLS(etype)); - -/* if (SPEC_OCLS(etype)->codesp ) */ -/* p_type = CPOINTER ; */ -/* else */ -/* if (SPEC_OCLS(etype)->fmap && !SPEC_OCLS(etype)->paged) */ -/* p_type = FPOINTER ; */ -/* else */ -/* if (SPEC_OCLS(etype)->fmap && SPEC_OCLS(etype)->paged) */ -/* p_type = PPOINTER; */ -/* else */ -/* if (SPEC_OCLS(etype) == idata ) */ -/* p_type = IPOINTER ; */ -/* else */ -/* p_type = POINTER ; */ } /* the first two bytes are known */ @@ -7300,10 +7287,10 @@ static void genCast (iCode *ic) offset++; } - /* now depending on the sign of the destination */ + /* now depending on the sign of the source && 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--) aopPut(AOP(result),zero,offset++); } else { -- 2.47.2