1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 07:29:33 +00:00

Opt_a_tosicmp likely has a bug which will incorrectly migrate a label on a replaced op in one case.

This commit is contained in:
bbbradsmith 2023-02-18 00:13:34 -05:00
parent 78263cd24b
commit 4e411e8526

View File

@ -1208,6 +1208,8 @@ static unsigned Opt_a_tosicmp (StackOpData* D)
/* RHS src is not directly comparable */
X = NewCodeEntry (OP65_STA, AM65_ZP, D->ZPHi, 0, D->OpEntry->LI);
InsertEntry (D, X, D->Rhs.A.ChgIndex + 1);
/* RHS insertion may have moved the OpIndex, recalculate insertion point to prevent label migration. */
D->IP = D->OpIndex + 1;
/* Cmp with stored RHS */
X = NewCodeEntry (OP65_CMP, AM65_ZP, D->ZPHi, 0, D->OpEntry->LI);