From 0ab45f63f0bbacbad2a8b3c4f8ca2b26330ca9bb Mon Sep 17 00:00:00 2001 From: cuz Date: Mon, 4 Dec 2000 21:01:50 +0000 Subject: [PATCH] Fixed a bug git-svn-id: svn://svn.cc65.org/cc65/trunk@550 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/cc65/expr.c | 11 ++++++----- src/cc65/expr.h | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/cc65/expr.c b/src/cc65/expr.c index 26f8a8d5c..ae0cd105a 100644 --- a/src/cc65/expr.c +++ b/src/cc65/expr.c @@ -198,8 +198,8 @@ unsigned assignadjust (type* lhst, struct expent* rhs) * set to the type of the left hand side. */ { - /* Get the type of the right hand side. Treat function types as - * pointer-to-function + /* Get the type of the right hand side. Treat function types as + * pointer-to-function */ type* rhst = rhs->e_tptr; if (IsTypeFunc (rhst)) { @@ -1316,11 +1316,12 @@ static void pre_incdec (struct expent* lval, void (*inc) (unsigned, unsigned lon g_subeqstatic (flags, lval->e_const, 0, val); } } else if (lval->e_flags & E_MEXPR) { - /* Address in a/x. */ + /* Address in a/x, check if we have an offset */ + unsigned Offs = (lval->e_flags == E_MEOFFS)? lval->e_const : 0; if (inc == g_inc) { - g_addeqind (flags, lval->e_const, val); + g_addeqind (flags, Offs, val); } else { - g_subeqind (flags, lval->e_const, val); + g_subeqind (flags, Offs, val); } } else { Internal ("Invalid addressing mode"); diff --git a/src/cc65/expr.h b/src/cc65/expr.h index 7768d3540..a790b70ad 100644 --- a/src/cc65/expr.h +++ b/src/cc65/expr.h @@ -27,7 +27,7 @@ #define E_MLOCAL 0x0040 /* Reference to local variable (stack offset) */ #define E_MCONST 0x0020 /* Constant value */ #define E_MEXPR 0x0010 /* Result is in primary register */ -#define E_MEOFFS 0x0011 /* Offset is in primary register, base on stack */ +#define E_MEOFFS 0x0011 /* Base is in primary register, const offset */ #define E_MCTYPE 0x0007 /* Type of a constant */ #define E_TCONST 0x0000 /* Constant */ -- 2.39.5