From 7c9bf720d8861c529f056532a308b1dbc94c25ab Mon Sep 17 00:00:00 2001 From: cuz Date: Fri, 12 Jul 2002 08:45:42 +0000 Subject: [PATCH] Fixed a bug git-svn-id: svn://svn.cc65.org/cc65/trunk@1350 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/cc65/coptind.c | 4 ++-- src/cc65/expr.c | 16 ++++++---------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/cc65/coptind.c b/src/cc65/coptind.c index 22aae197b..d0b9809c9 100644 --- a/src/cc65/coptind.c +++ b/src/cc65/coptind.c @@ -504,7 +504,7 @@ unsigned OptJumpTarget (CodeSeg* S) * is not attached to the jump itself */ if (E2 != 0 && - (E2->Info & OF_UBRA) != 0 && + (E2->Info & OF_UBRA) != 0 && E2->JumpTo && E2->JumpTo->Owner != E2) { @@ -875,7 +875,7 @@ unsigned OptDupLoads (CodeSeg* S) */ if (In->RegY >= 0 && /* Value of Y is known */ 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; diff --git a/src/cc65/expr.c b/src/cc65/expr.c index 53577e39d..0f4a6a657 100644 --- a/src/cc65/expr.c +++ b/src/cc65/expr.c @@ -223,14 +223,12 @@ unsigned assignadjust (type* lhst, ExprDesc* rhs) } else if (!IsClassInt (rhst)) { Error ("Incompatible types"); } else { - /* Adjust the int types. To avoid manipulation of TOS mark lhs - * as const. - */ + /* Convert the rhs to the type of the lhs. */ unsigned flags = TypeOf (rhst); if (rhs->Flags == E_MCONST) { flags |= CF_CONST; } - return g_typeadjust (TypeOf (lhst) | CF_CONST, flags); + return g_typecast (TypeOf (lhst), flags); } } else if (IsClassPtr (lhst)) { if (IsClassPtr (rhst)) { @@ -246,7 +244,7 @@ unsigned assignadjust (type* lhst, ExprDesc* rhs) case TC_INCOMPATIBLE: Error ("Incompatible pointer types"); break; - + case TC_QUAL_DIFF: Error ("Pointer types differ in type qualifiers"); break; @@ -279,7 +277,7 @@ unsigned assignadjust (type* lhst, ExprDesc* rhs) return CF_INT; } - + void DefineData (ExprDesc* Expr) /* 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; rflags |= TypeOf (lval2.Type); - /* Adjust the rhs to the lhs. To avoid manipulation of the TOS, mark - * the lhs as const. - */ - g_typeadjust (lflags | CF_CONST, rflags); + /* Cast the rhs to the type of the lhs */ + g_typecast (lflags, rflags); /* Output apropriate code */ if (lval->Flags & E_MGLOBAL) { -- 2.39.5