From 560018b766956ab7b804b1fbde0be293efe5f8c2 Mon Sep 17 00:00:00 2001 From: sandeep Date: Sat, 20 May 2000 16:58:21 +0000 Subject: [PATCH] fixed the array bug git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@251 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/SDCCast.h | 1 + src/SDCCicode.c | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/SDCCast.h b/src/SDCCast.h index 2306354f..df111185 100644 --- a/src/SDCCast.h +++ b/src/SDCCast.h @@ -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 == '<' || \ diff --git a/src/SDCCicode.c b/src/SDCCicode.c index 03a7c456..ec5a26c6 100644 --- a/src/SDCCicode.c +++ b/src/SDCCicode.c @@ -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); } -- 2.47.2