-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Description
Version of emscripten/emsdk:
docker image with emscripten/emsdk:3.1.74
file test.js
addToLibrary({
my_js_1: function() {
return 1;
},
my_js_2: function() {
return 2;
},
});
file test.cc
#include <emscripten/console.h>
extern "C" {
extern bool my_js_1(void);
extern bool my_js_2(void);
}
int main() {
if (my_js_1()) {
emscripten_out("my_js_1 is truthy");
} else {
emscripten_out("my_js_1 is falsy");
}
if (my_js_2()) {
emscripten_out("my_js_2 is truthy");
} else {
emscripten_out("my_js_2 is falsy");
}
return 0;
}
command
$ em++ --js-library test.js -o build/O0.js -O0 test.cc
$ em++ --js-library test.js -o build/O1.js -O1 test.cc
What I expected
$ node build/O0.js
my_js_1 is truthy
my_js_2 is truthy
$ node build/O1.js
my_js_1 is truthy
my_js_2 is truthy
But the result for actual run is
$ node build/O0.js
my_js_1 is truthy
my_js_2 is falsy // <--- π²
$ node build/O1.js
my_js_1 is truthy
my_js_2 is truthy
-O2
, -O3
work same as -O1
Severity: flakiness on wasm worker + -O0
option
emscripten/src/library_wasm_worker.js
Line 239 in 1092ec3
emscripten_current_thread_is_wasm_worker: () => { |
emscripten_current_thread_is_wasm_worker: () => {
#if WASM_WORKERS
return ENVIRONMENT_IS_WASM_WORKER; // <-- returns number π
#else
// implicit return 0;
#endif
},
Metadata
Metadata
Assignees
Labels
No labels