Fixed/worked around a bug

git-svn-id: svn://svn.cc65.org/cc65/trunk@1343 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2002-07-10 21:04:02 +00:00
parent 63123a3566
commit f93eb903ba

View File

@@ -240,21 +240,21 @@ unsigned assignadjust (type* lhst, ExprDesc* rhs)
* - the lhs pointer is a void pointer. * - the lhs pointer is a void pointer.
*/ */
if (!IsTypeVoid (Indirect (lhst)) && !IsTypeVoid (Indirect (rhst))) { if (!IsTypeVoid (Indirect (lhst)) && !IsTypeVoid (Indirect (rhst))) {
/* Compare the types */ /* Compare the types */
switch (TypeCmp (lhst, rhst)) { switch (TypeCmp (lhst, rhst)) {
case TC_INCOMPATIBLE: case TC_INCOMPATIBLE:
Error ("Incompatible pointer types"); Error ("Incompatible pointer types");
break; break;
case TC_QUAL_DIFF: case TC_QUAL_DIFF:
Error ("Pointer types differ in type qualifiers"); Error ("Pointer types differ in type qualifiers");
break; break;
default: default:
/* Ok */ /* Ok */
break; break;
} }
} }
} else if (IsClassInt (rhst)) { } else if (IsClassInt (rhst)) {
/* Int to pointer assignment is valid only for constant zero */ /* Int to pointer assignment is valid only for constant zero */
@@ -279,7 +279,7 @@ unsigned assignadjust (type* lhst, ExprDesc* rhs)
return CF_INT; return CF_INT;
} }
void DefineData (ExprDesc* Expr) void DefineData (ExprDesc* Expr)
/* Output a data definition for the given expression */ /* Output a data definition for the given expression */
@@ -2947,8 +2947,10 @@ static void addsubeq (const GenDesc* Gen, ExprDesc *lval, int k)
lflags |= TypeOf (lval->Type) | CF_FORCECHAR; lflags |= TypeOf (lval->Type) | CF_FORCECHAR;
rflags |= TypeOf (lval2.Type); rflags |= TypeOf (lval2.Type);
/* Adjust the rhs to the lhs */ /* Adjust the rhs to the lhs. To avoid manipulation of the TOS, mark
g_typeadjust (lflags, rflags); * the lhs as const.
*/
g_typeadjust (lflags | CF_CONST, rflags);
/* Output apropriate code */ /* Output apropriate code */
if (lval->Flags & E_MGLOBAL) { if (lval->Flags & E_MGLOBAL) {