fixed the array bug
authorsandeep <sandeep@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 20 May 2000 16:58:21 +0000 (16:58 +0000)
committersandeep <sandeep@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 20 May 2000 16:58:21 +0000 (16:58 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@251 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCast.h
src/SDCCicode.c

index 2306354fd5a1139d97195f1aca655c322d099d62..df1111852735ce27aa620325dbe09d48929970b3 100644 (file)
@@ -106,6 +106,7 @@ typedef  struct   ast {
 #define  IS_AST_VALUE(x)       (x && x->type == EX_VALUE && x->opval.val)
 #define  IS_AST_LINK(x)                (x->type == EX_LINK)   
 #define  IS_AST_NOT_OPER(x)    (x && IS_AST_OP(x) && x->opval.op == '!')
+#define  IS_ARRAY_OP(x) (IS_AST_OP(x) && x->opval.op == '[')
 #define  IS_COMPARE_OP(x)      (IS_AST_OP(x)           &&              \
                                  (x->opval.op == '>'   ||              \
                                   x->opval.op == '<'   ||              \
index 03a7c45688c17865cf98f1170c04130a0cb7a507..ec5a26c6f75c9e1b9ffda09459bdafb64cd640ef 100644 (file)
@@ -2756,8 +2756,13 @@ operand *ast2iCode (ast *tree)
            (tree->opval.op == '&' && !tree->right) ||
            tree->opval.op == PTR_OP) {
            lvaluereq++;
-           left = operandFromAst(tree->left);
-           lvaluereq--;
+           if (IS_ARRAY_OP(tree->left) && IS_ARRAY_OP(tree->left->left)) {
+               lvaluereq--;
+               left = operandFromAst(tree->left);
+           } else {
+               left = operandFromAst(tree->left);
+               lvaluereq--;
+           }
        } else {
            left =  operandFromAst(tree->left);
        }