fix invalid optimization for ptr-value

This commit is contained in:
Irmen de Jong
2025-08-28 19:48:13 +02:00
parent 0285a4cce1
commit 9a76941e10
3 changed files with 36 additions and 20 deletions
@@ -351,7 +351,7 @@ class StatementOptimizer(private val program: Program,
// pointer arithmetic for 6502 target
if (options.compTarget.cpu != CpuType.VIRTUAL) {
if(!assignment.isAugmentable && (bexpr.operator=="+" || bexpr.operator=="-")) {
if(bexpr.operator=="+" && !assignment.isAugmentable) {
if(targetIDt.isUnsignedWord || targetIDt.getOrUndef().isPointerToByte) {
val leftDt = bexpr.left.inferType(program).getOrUndef()
val rightDt = bexpr.right.inferType(program).getOrUndef()