From 2d3b0f11466fd7c6634d38f1cdbd20fd0e27f060 Mon Sep 17 00:00:00 2001 From: uz Date: Tue, 8 Sep 2009 20:08:21 +0000 Subject: [PATCH] Fixed a problem similar to the one in Assignment() some time ago: An expression that yields a constant value may have side effects, and the expression code must not be removed in this case. git-svn-id: svn://svn.cc65.org/cc65/trunk@4137 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/cc65/expr.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/cc65/expr.c b/src/cc65/expr.c index 7f30bb11b..211b1b6d4 100644 --- a/src/cc65/expr.c +++ b/src/cc65/expr.c @@ -1721,7 +1721,14 @@ static void hie_internal (const GenDesc* Ops, /* List of generators */ } /* Get the right hand side */ - rconst = (evalexpr (CF_NONE, hienext, &Expr2) == 0); + MarkedExprWithCheck (hienext, &Expr2); + + /* Check for a constant expression */ + rconst = (ED_IsConstAbs (&Expr2) && ED_CodeRangeIsEmpty (&Expr2)); + if (!rconst) { + /* Not constant, load into the primary */ + LoadExpr (CF_NONE, &Expr2); + } /* Check the type of the rhs */ if (!IsClassInt (Expr2.Type)) {