Fixed a bug

git-svn-id: svn://svn.cc65.org/cc65/trunk@1350 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2002-07-12 08:45:42 +00:00
parent 8c7f650621
commit 7c9bf720d8
2 changed files with 8 additions and 12 deletions

View File

@@ -504,7 +504,7 @@ unsigned OptJumpTarget (CodeSeg* S)
* is not attached to the jump itself * is not attached to the jump itself
*/ */
if (E2 != 0 && if (E2 != 0 &&
(E2->Info & OF_UBRA) != 0 && (E2->Info & OF_UBRA) != 0 &&
E2->JumpTo && E2->JumpTo &&
E2->JumpTo->Owner != E2) { E2->JumpTo->Owner != E2) {
@@ -875,7 +875,7 @@ unsigned OptDupLoads (CodeSeg* S)
*/ */
if (In->RegY >= 0 && /* Value of Y is known */ if (In->RegY >= 0 && /* Value of Y is known */
E->AM == AM65_ZP && /* Store into zp */ E->AM == AM65_ZP && /* Store into zp */
In->RegX == RegVal (E->Chg, In)) { /* Value identical */ In->RegY == RegVal (E->Chg, In)) { /* Value identical */
Delete = 1; Delete = 1;

View File

@@ -223,14 +223,12 @@ unsigned assignadjust (type* lhst, ExprDesc* rhs)
} else if (!IsClassInt (rhst)) { } else if (!IsClassInt (rhst)) {
Error ("Incompatible types"); Error ("Incompatible types");
} else { } else {
/* Adjust the int types. To avoid manipulation of TOS mark lhs /* Convert the rhs to the type of the lhs. */
* as const.
*/
unsigned flags = TypeOf (rhst); unsigned flags = TypeOf (rhst);
if (rhs->Flags == E_MCONST) { if (rhs->Flags == E_MCONST) {
flags |= CF_CONST; flags |= CF_CONST;
} }
return g_typeadjust (TypeOf (lhst) | CF_CONST, flags); return g_typecast (TypeOf (lhst), flags);
} }
} else if (IsClassPtr (lhst)) { } else if (IsClassPtr (lhst)) {
if (IsClassPtr (rhst)) { if (IsClassPtr (rhst)) {
@@ -246,7 +244,7 @@ unsigned assignadjust (type* lhst, ExprDesc* rhs)
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;
@@ -279,7 +277,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,10 +2945,8 @@ 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. To avoid manipulation of the TOS, mark /* Cast the rhs to the type of the lhs */
* the lhs as const. g_typecast (lflags, rflags);
*/
g_typeadjust (lflags | CF_CONST, rflags);
/* Output apropriate code */ /* Output apropriate code */
if (lval->Flags & E_MGLOBAL) { if (lval->Flags & E_MGLOBAL) {