From 55815ea10cfa3a779b44399f99dd0cf1cb4956f2 Mon Sep 17 00:00:00 2001 From: Spiro Trikaliotis Date: Tue, 14 Oct 2014 13:41:17 +0200 Subject: [PATCH] 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. --- src/cc65/coptstop.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) 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) { -- 2.39.5