Fix repeated REPT nodes in backtraces

This commit is contained in:
Rangi
2025-10-06 16:36:55 -04:00
parent 0c9920d4a6
commit fba0562650
11 changed files with 145 additions and 55 deletions

View File

@@ -0,0 +1,23 @@
section "test", rom0
for v1, 4
if v1 == 3
for v2, 3
if v2 == 2
for v3, 2
if v3 == 1
rept 1
macro m
assert \1
endm
endr
rept 1
rept 2
m @
endr
endr
endc
endr
endc
endr
endc
endr

View File

@@ -0,0 +1,17 @@
error: assert failure
at rept-trace/a.asm::REPT~4::REPT~3::REPT~2::REPT~1::m(10)
<- rept-trace/a.asm::REPT~4::REPT~3::REPT~2::REPT~1::REPT~1(15)
<- rept-trace/a.asm::REPT~4::REPT~3::REPT~2::REPT~1(14)
<- rept-trace/a.asm::REPT~4::REPT~3::REPT~2(13)
<- rept-trace/a.asm::REPT~4::REPT~3(6)
<- rept-trace/a.asm::REPT~4(4)
<- rept-trace/a.asm(2)
error: assert failure
at rept-trace/a.asm::REPT~4::REPT~3::REPT~2::REPT~1::m(10)
<- rept-trace/a.asm::REPT~4::REPT~3::REPT~2::REPT~1::REPT~2(15)
<- rept-trace/a.asm::REPT~4::REPT~3::REPT~2::REPT~1(14)
<- rept-trace/a.asm::REPT~4::REPT~3::REPT~2(13)
<- rept-trace/a.asm::REPT~4::REPT~3(6)
<- rept-trace/a.asm::REPT~4(4)
<- rept-trace/a.asm(2)
Linking failed with 2 errors

View File

@@ -266,13 +266,19 @@ evaluateTest
test="pipeline"
startTest
continueTest
("$RGBASM" -Weverything -Bcollapse -o - - | \
"$RGBLINK" -Weverything -Bcollapse -o - - | \
"$RGBFIX" -Weverything -v -p 0xff -) < "$test"/a.asm > "$gbtemp"
("$RGBASM" -o - - | "$RGBLINK" -o - - | "$RGBFIX" -v -p 0xff -) < "$test"/a.asm > "$gbtemp"
# This test does not trim its output with 'dd' because it needs to verify the correct output size
tryCmp "$test"/out.gb "$gbtemp"
evaluateTest
test="rept-trace"
startTest
"$RGBASM" -o "$otemp" "$test"/a.asm
continueTest
rgblinkQuiet -Bno-collapse -o "$gbtemp" "$otemp" 2>"$outtemp"
tryDiff "$test"/out.err "$outtemp"
evaluateTest
test="same-consts"
startTest
"$RGBASM" -o "$otemp" "$test"/a.asm