diff options
Diffstat (limited to 'test/wasm_backend/globals_only.cpp')
-rw-r--r-- | test/wasm_backend/globals_only.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/wasm_backend/globals_only.cpp b/test/wasm_backend/globals_only.cpp new file mode 100644 index 000000000..9a2f1bcc8 --- /dev/null +++ b/test/wasm_backend/globals_only.cpp @@ -0,0 +1,21 @@ +#include <emscripten.h> + +char c = 10; +short s = 20; +int i = 55; + +void print(int v) { + int *x = (int*)8; + *x = v; + EM_ASM({ + Module.print("print: " + HEAP32[8>>2]); + }); +} + +int main() { + print(1); + print(c); + print(s); + print(i); +} + |