binaryen
binaryen copied to clipboard
StackCheck pass can do that wrong thing when no stack pointer is present
I notices a strange failure on HEAD with a test that I guess we don't run anywhere: ./test/runner core2ss.test_pthread_dylink_tls .
The problem is with -sSTACK_OVERFLOW_CHECK which runs that StackCheck check pass, which depends on being able to find the stack pointer global (__stack_pointer), but in this case the side module its being run on doesn't contain any stack usage and so it simply doesn't have a __stack_pointer global. The StackCheck pass then assumes that the first imported global is that stack pointer (but in fact its env.__memory_base).. and then it fails the stack check during __wasm_init_memory when it first reads this global.