Closed
Description
Hello all,
I have found a strange behaviour with TypedArray.set().
The following code fragment works fine in an as-pect test or when the code is compiled without the "--optimize" flag:
let buffer = new Uint8Array(1);
buffer[0] = 42;
const oldBuffer = buffer;
buffer = new Uint8Array(2);
buffer.set(oldBuffer);
buffer[1] = 1;
// buffer[0] === 42
However, when the "--optimize" flag is used, buffer[0] is set to 0 at the end...
Here is a link to see this bug in action: https://webassembly.studio/?f=wtzfbyvd2q
Let me know if you need anything else!