From: cuz Date: Wed, 17 Apr 2002 18:52:03 +0000 (+0000) Subject: Fixed a bug X-Git-Tag: V2.12.0~2378 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=99de22ffe2657ed49896df13d13e472a3c7f762c;p=cc65 Fixed a bug git-svn-id: svn://svn.cc65.org/cc65/trunk@1242 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/cc65/coptind.c b/src/cc65/coptind.c index 3c04f63a7..22aae197b 100644 --- a/src/cc65/coptind.c +++ b/src/cc65/coptind.c @@ -500,8 +500,13 @@ unsigned OptJumpTarget (CodeSeg* S) /* Get next entry */ E2 = CS_GetNextEntry (S, I); - /* Check if we have a jump or branch, and a matching label */ - if (E2 && (E2->Info & OF_UBRA) != 0 && E2->JumpTo) { + /* Check if we have a jump or branch, and a matching label, which + * is not attached to the jump itself + */ + if (E2 != 0 && + (E2->Info & OF_UBRA) != 0 && + E2->JumpTo && + E2->JumpTo->Owner != E2) { /* Get the entry preceeding the branch target */ T1 = CS_GetPrevEntry (S, CS_GetEntryIndex (S, E2->JumpTo->Owner)); @@ -908,7 +913,7 @@ unsigned OptDupLoads (CodeSeg* S) if (In->RegA >= 0 && In->RegA == In->RegX && (N = CS_GetNextEntry (S, I)) != 0 && - !CE_UseLoadFlags (N)) { + !CE_UseLoadFlags (N)) { /* Value is identical and not followed by a branch */ Delete = 1; } @@ -967,7 +972,7 @@ unsigned OptDupLoads (CodeSeg* S) } - /* Free register info */ + /* Free register info */ CS_FreeRegInfo (S); /* Return the number of changes made */ @@ -1060,7 +1065,7 @@ unsigned OptTransfers (CodeSeg* S) */ if ((X = CS_GetNextEntry (S, I+1)) == 0) { goto NextEntry; - } + } if (CE_UseLoadFlags (X)) { if (I == 0) { /* No preceeding entry */