mirror of
https://github.com/cc65/cc65.git
synced 2025-01-10 19:29:45 +00:00
Fixed OptCmp1 with certain code patterns with labels.
This commit is contained in:
parent
f8cdb2ab63
commit
5ef420af5a
@ -309,10 +309,10 @@ unsigned OptCmp1 (CodeSeg* S)
|
|||||||
|
|
||||||
/* Insert the ora instead */
|
/* Insert the ora instead */
|
||||||
X = NewCodeEntry (OP65_ORA, L[0]->AM, L[0]->Arg, 0, L[0]->LI);
|
X = NewCodeEntry (OP65_ORA, L[0]->AM, L[0]->Arg, 0, L[0]->LI);
|
||||||
CS_InsertEntry (S, X, I);
|
CS_InsertEntry (S, X, I+3);
|
||||||
|
|
||||||
/* Remove all other instructions */
|
/* Remove all other instructions */
|
||||||
CS_DelEntries (S, I+1, 3);
|
CS_DelEntries (S, I, 3);
|
||||||
|
|
||||||
/* Remember, we had changes */
|
/* Remember, we had changes */
|
||||||
++Changes;
|
++Changes;
|
||||||
|
23
test/val/bug1690.c
Normal file
23
test/val/bug1690.c
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/* OptCmp1 messed up with labels */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
register unsigned int x = 0x200;
|
||||||
|
register unsigned int y = 0;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
++y;
|
||||||
|
}
|
||||||
|
while (--x);
|
||||||
|
|
||||||
|
if (y != 0x200)
|
||||||
|
{
|
||||||
|
printf("0x%X\n", y);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user