]> git.sur5r.net Git - cc65/commitdiff
Fixed a problem with OptJumpTarget1: The inspected jump must not have a label
authoruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Mon, 14 Sep 2009 18:36:38 +0000 (18:36 +0000)
committeruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Mon, 14 Sep 2009 18:36:38 +0000 (18:36 +0000)
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

index 5c0fe8d6c9dd76b3466da0803c6c2ada6bfe5fab..32537b92a0501291811b915145c78a4bd4c75b5a 100644 (file)
@@ -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);