Fixed missing register move in if statements
This commit is contained in:
23
tests/programs/branch-save.q
Normal file
23
tests/programs/branch-save.q
Normal 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
|
||||
}
|
@ -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},
|
||||
|
Reference in New Issue
Block a user