From: Spiro Trikaliotis Date: Tue, 14 Oct 2014 11:41:17 +0000 (+0200) Subject: Equality problem (Ullrich von Bassewitz) X-Git-Tag: V2.15~41^2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=refs%2Fpull%2F138%2Fhead;p=cc65 Equality problem (Ullrich von Bassewitz) Neil Stockbridge reported a problem with equality comparisons on cc65.org's mailing list: http://www.cc65.org/mailarchive/2014-10/11680.html Uz provided a fix for it: http://www.cc65.org/mailarchive/2014-10/11683.html This pull request ask to add the fix to cc65 on github. --- diff --git a/src/cc65/coptstop.c b/src/cc65/coptstop.c index cf6392bd3..427d0bd13 100644 --- a/src/cc65/coptstop.c +++ b/src/cc65/coptstop.c @@ -766,8 +766,12 @@ static unsigned Opt_toseqax_tosneax (StackOpData* D, const char* BoolTransformer InsertEntry (D, X, D->IP++); /* Lhs load entries can be removed */ - D->Lhs.X.Flags |= LI_REMOVE; - D->Lhs.A.Flags |= LI_REMOVE; + if (LoadX->AM != AM65_IMM) { + D->Lhs.X.Flags |= LI_REMOVE; + } + if (LoadA->AM != AM65_IMM) { + D->Lhs.A.Flags |= LI_REMOVE; + } } else if ((D->Rhs.A.Flags & (LI_DIRECT | LI_RELOAD_Y)) == LI_DIRECT && (D->Rhs.X.Flags & (LI_DIRECT | LI_RELOAD_Y)) == LI_DIRECT) { @@ -790,8 +794,12 @@ static unsigned Opt_toseqax_tosneax (StackOpData* D, const char* BoolTransformer InsertEntry (D, X, D->IP++); /* Rhs load entries can be removed */ - D->Rhs.X.Flags |= LI_REMOVE; - D->Rhs.A.Flags |= LI_REMOVE; + if (LoadX->AM != AM65_IMM) { + D->Rhs.X.Flags |= LI_REMOVE; + } + if (LoadA->AM != AM65_IMM) { + D->Rhs.A.Flags |= LI_REMOVE; + } } else if ((D->Rhs.A.Flags & LI_DIRECT) != 0 && (D->Rhs.X.Flags & LI_DIRECT) != 0) {