From 652e5eba68dfc18fc4675dd54ee0c87b10e2634b Mon Sep 17 00:00:00 2001 From: johanknol Date: Mon, 6 Jan 2003 12:30:51 +0000 Subject: [PATCH] fixed array add git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2139 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 4 ++++ src/SDCCicode.c | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c4d6b28d..a704744b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2003-01-06 + + * src/SDCCicode.c: fixed array add + 2002-01-05 Bernhard Held * sim/ucsim/z80.src/inst.cc: #include for gcc 3.2 diff --git a/src/SDCCicode.c b/src/SDCCicode.c index e20c2d82..390c6c72 100644 --- a/src/SDCCicode.c +++ b/src/SDCCicode.c @@ -1617,6 +1617,7 @@ usualBinaryConversions (operand ** op1, operand ** op2) sym_link *ltype = operandType (*op1); ctype = computeType (ltype, rtype); + *op1 = geniCodeCast (ctype, *op1, TRUE); *op2 = geniCodeCast (ctype, *op2, TRUE); @@ -2048,9 +2049,11 @@ geniCodeAdd (operand * left, operand * right, int lvl) int isarray = 0; LRTYPE; +#if 0 /* if left is an array then array access */ if (IS_ARRAY (ltype)) return geniCodeArray (left, right,lvl); +#endif /* if the right side is LITERAL zero */ /* return the left side */ @@ -2062,7 +2065,7 @@ geniCodeAdd (operand * left, operand * right, int lvl) return right; /* if left is a pointer then size */ - if (IS_PTR (ltype)) + if (IS_PTR (ltype) || IS_ARRAY(ltype)) { isarray = left->isaddr; // there is no need to multiply with 1 -- 2.47.2