From 35ff1d996accfc8bfbfc97eda61f9d9e79d6f058 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Sun, 19 Mar 2023 21:53:49 +0100 Subject: [PATCH] only reuse actual counter vars --- codeGenCpu6502/src/prog8/codegen/cpu6502/AsmGen.kt | 4 ++-- docs/source/todo.rst | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/codeGenCpu6502/src/prog8/codegen/cpu6502/AsmGen.kt b/codeGenCpu6502/src/prog8/codegen/cpu6502/AsmGen.kt index dfcc44f43..4e76c43e7 100644 --- a/codeGenCpu6502/src/prog8/codegen/cpu6502/AsmGen.kt +++ b/codeGenCpu6502/src/prog8/codegen/cpu6502/AsmGen.kt @@ -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 diff --git a/docs/source/todo.rst b/docs/source/todo.rst index 0f0ad61de..dfcd71c79 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -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)