summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
fb4770d)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3140
4a8a32a2-be11-0410-ad9d-
d568d2c75423
+2004-01-19 Bernhard Held <bernhard@bernhardheld.de>
+
+ * src/SDCCicode.c (geniCodeArray): applied patch from Stas Sergeev
+ proposed in FR #877103
+
2004-01-18 Bernhard Held <bernhard@bernhardheld.de>
* src/SDCCval.c (cheapestVal): added missing checks
2004-01-18 Bernhard Held <bernhard@bernhardheld.de>
* src/SDCCval.c (cheapestVal): added missing checks
geniCodeArray (operand * left, operand * right,int lvl)
{
iCode *ic;
geniCodeArray (operand * left, operand * right,int lvl)
{
iCode *ic;
sym_link *ltype = operandType (left);
bool indexUnsigned;
sym_link *ltype = operandType (left);
bool indexUnsigned;
return geniCodeDerefPtr (geniCodeAdd (left, right, lvl), lvl);
}
return geniCodeDerefPtr (geniCodeAdd (left, right, lvl), lvl);
}
+ size = operandFromLit (getSize (ltype->next));
+ SPEC_USIGN (getSpec (operandType (size))) = 1;
indexUnsigned = IS_UNSIGNED (getSpec (operandType (right)));
indexUnsigned = IS_UNSIGNED (getSpec (operandType (right)));
- right = geniCodeMultiply (right,
- operandFromLit (getSize (ltype->next)), (getArraySizePtr(left) >= INTSIZE));
+ right = geniCodeMultiply (right, size, (getArraySizePtr(left) >= INTSIZE));
/* Even if right is a 'unsigned char', the result will be a 'signed int' due to the promotion rules.
It doesn't make sense when accessing arrays, so let's fix it here: */
if (indexUnsigned)
/* Even if right is a 'unsigned char', the result will be a 'signed int' due to the promotion rules.
It doesn't make sense when accessing arrays, so let's fix it here: */
if (indexUnsigned)