-
-
Notifications
You must be signed in to change notification settings - Fork 688
break within the else clause of an if within a while loop traps #1239
Copy link
Copy link
Closed
Labels
Description
Program:
export function test(): void {
let foo = 0
while (true) {
foo++
if (foo < 10) {
3
} else {
break
}
}
return
}compiled with: asc test.ts -o test.wasm -O3 --runtime none
run with wasmtime results in
Error: failed to run main module `test.wasm`
Caused by:
0: failed to invoke `test`
1: wasm trap: unreachable, source location: @0049
wasm backtrace:
0: <unknown>!<wasm function 0>
I originally discovered this running on Node.js, but checked with wasmtime as well.
If the logic is reversed and the break is in the if clause, this works just fine.
Reactions are currently unavailable