only reuse actual counter vars

This commit is contained in:
Irmen de Jong 2023-03-19 21:53:49 +01:00
parent deea0b05cb
commit 35ff1d996a
2 changed files with 2 additions and 3 deletions

View File

@ -766,9 +766,9 @@ $repeatLabel lda $counterVar
}
val isNested = parent is PtRepeatLoop
if(!isNested) {
if(!isNested && !options.useRPN) {
// we can re-use a counter var from the subroutine if it already has one for that datatype
val existingVar = asmInfo.extraVars.firstOrNull { it.first==dt }
val existingVar = asmInfo.extraVars.firstOrNull { it.first==dt && it.second.endsWith("counter") }
if(existingVar!=null) {
if(!preferZeropage || existingVar.third!=null)
return existingVar.second

View File

@ -1,6 +1,5 @@
TODO
====
RPN: examples/line-circle-txt crashes
RPN: examples/turtlegfx crashes
RPN: examples/maze crashes
RPN: examples/bsieve,charset compilation crash (bit shift expression)