Fixed a bug

git-svn-id: svn://svn.cc65.org/cc65/trunk@1922 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2003-02-02 21:05:39 +00:00
parent 4fe0f3ae3c
commit c5868d30c0

View File

@@ -501,7 +501,7 @@ void CheckBoolExpr (ExprDesc* lval)
void exprhs (unsigned flags, int k, ExprDesc *lval) void exprhs (unsigned flags, int k, ExprDesc* lval)
/* Put the result of an expression into the primary register */ /* Put the result of an expression into the primary register */
{ {
int f; int f;
@@ -2156,8 +2156,16 @@ static void parseadd (int k, ExprDesc* lval)
flags = CF_PTR; flags = CF_PTR;
lval->Type = lval2.Type; lval->Type = lval2.Type;
} else if (IsClassInt (lhst) && IsClassInt (rhst)) { } else if (IsClassInt (lhst) && IsClassInt (rhst)) {
/* Integer addition */ /* Integer addition. Note: Result is never constant.
flags = typeadjust (lval, &lval2, 0); * Problem here is that typeadjust does not know if the
* variable is an rvalue or lvalue, so if both operands
* are dereferenced constant numeric addresses, typeadjust
* thinks the operation works on constants. Removing
* CF_CONST here means handling the symptoms, however, the
* whole parser is such a mess that I fear to break anything
* when trying to apply another solution.
*/
flags = typeadjust (lval, &lval2, 0) & ~CF_CONST;
} else { } else {
/* OOPS */ /* OOPS */
Error ("Invalid operands for binary operator `+'"); Error ("Invalid operands for binary operator `+'");