Fixed missing register move in if statements

This commit is contained in:
2025-02-03 13:17:48 +01:00
parent 646dafd216
commit cb6b3a4cd0
5 changed files with 63 additions and 14 deletions

View File

@ -0,0 +1,23 @@
main() {
a, b := f(5)
assert a == 0
assert b == 5
a, b = f(15)
assert a == 1
assert b == 5
a, b = f(25)
assert a == 2
assert b == 5
}
f(b Int) -> (Int, Int) {
a := 0
if b >= 10 {
a, b = b / 10
}
return a, b
}

View File

@ -54,6 +54,7 @@ var programs = []struct {
{"branch-and", "", "", 0},
{"branch-or", "", "", 0},
{"branch-both", "", "", 0},
{"branch-save", "", "", 0},
{"jump-near", "", "", 0},
{"switch", "", "", 0},
{"loop", "", "", 0},