The condition if 0 <= i && i <= Array.length vals then for Mvecset lets the interpreter crash on (let ($x (makevec 0 0)) (store $x 0 0)) with Fatal error: exception Invalid_argument("index out of bounds") rather than report Undefined behaviour: index out of bounds: 0.
The condition
if 0 <= i && i <= Array.length vals then
forMvecset
lets the interpreter crash on(let ($x (makevec 0 0)) (store $x 0 0))
withFatal error: exception Invalid_argument("index out of bounds")
rather than reportUndefined behaviour: index out of bounds: 0
.The check is correct for
Mvecget
.Discovered by @tabareau