emscripten-core / emscripten-core/emscripten
[acorn-optimizer] unsignPointers can cause problems optional second argument `subarray`
Open
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
The `unsignPointers` pass will currently add `>>> 0` to all arguments to `\.subarray`.
However, if the value being passed is `undefined` this changes its meaning.
The case I found was in `library_glemu.js` which does something like this: `HEAP16.subarray(ptr, end ? end : undefined)`.
In the case when `end` is undefined this ends up being `end >>> 0` which is 0, and which is very different to `undefined` when passed as this argument.
Contributor guide
Assessment
This issue has not been assessed yet.