From 254e1169f2acbf737f14f1a5240be02ca58dfbdc Mon Sep 17 00:00:00 2001 From: uz Date: Mon, 14 Sep 2009 18:36:38 +0000 Subject: [PATCH] Fixed a problem with OptJumpTarget1: The inspected jump must not have a label attached, because the effective code changes for code jumping to this label if removals are applied. git-svn-id: svn://svn.cc65.org/cc65/trunk@4169 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/cc65/coptind.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/cc65/coptind.c b/src/cc65/coptind.c index 5c0fe8d6c..32537b92a 100644 --- a/src/cc65/coptind.c +++ b/src/cc65/coptind.c @@ -564,12 +564,13 @@ unsigned OptJumpTarget1 (CodeSeg* S) /* Get next entry */ E2 = CS_GetNextEntry (S, I); - /* Check if we have a jump or branch, and a matching label, which - * is not attached to the jump itself + /* Check if we have a jump or branch without a label attached, and + * a jump target, which is not attached to the jump itself */ - if (E2 != 0 && + if (E2 != 0 && (E2->Info & OF_UBRA) != 0 && - E2->JumpTo && + !CE_HasLabel (E2) && + E2->JumpTo && E2->JumpTo->Owner != E2) { /* Get the entry preceeding the branch target */ @@ -1805,7 +1806,7 @@ unsigned OptPushPop (CodeSeg* S) ++Changes; } else if ((E->Info & OF_CBRA) == 0 && - (!RegAUsed (S, I) || !ChgA)) { + (!RegAUsed (S, I) || !ChgA)) { /* We can remove the PHA and PLA instructions */ CS_DelEntry (S, Pop); -- 2.39.5