From: sandeep Date: Sat, 29 Dec 2001 23:43:12 +0000 (+0000) Subject: Fixed a bug in hasInc X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=aaa02ddab84bb3308eba33a95fe0ebfc6494ea50;hp=cd3f0aca1a5fa6e57c0c9b9324bd375db8b9955a;p=fw%2Fsdcc Fixed a bug in hasInc git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1747 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/src/mcs51/gen.c b/src/mcs51/gen.c index a1a50e41..9bec319a 100644 --- a/src/mcs51/gen.c +++ b/src/mcs51/gen.c @@ -4328,7 +4328,7 @@ ifxForOp (operand * op, iCode * ic) /* hasInc - operand is incremented before any other use */ /*-----------------------------------------------------------------*/ static iCode * -hasInc (operand *op, iCode *ic) +hasInc (operand *op, iCode *ic,int osize) { sym_link *type = operandType(op); sym_link *retype = getSpec (type); @@ -4339,7 +4339,7 @@ hasInc (operand *op, iCode *ic) if (!IS_SYMOP(op)) return NULL; if (IS_BITVAR(retype)||!IS_PTR(type)) return NULL; - isize = getSize(type->next); + if (osize != (isize = getSize(type->next))) return NULL; while (lic) { /* if operand of the form op = op + */ if (lic->op == '+' && isOperandEqual(IC_LEFT(lic),op) && @@ -8949,12 +8949,12 @@ gen51Code (iCode * lic) break; case GET_VALUE_AT_ADDRESS: - genPointerGet (ic, hasInc(IC_LEFT(ic),ic)); + genPointerGet (ic, hasInc(IC_LEFT(ic),ic,getSize(operandType(IC_LEFT(ic))))); break; case '=': if (POINTER_SET (ic)) - genPointerSet (ic, hasInc (IC_RESULT(ic),ic)); + genPointerSet (ic, hasInc (IC_RESULT(ic),ic,getSize(operandType(IC_RIGHT(ic))))); else genAssign (ic); break;