emscripten-core / emscripten-core/emscripten

Different behavior between native and WASM

Open
#16,154 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 6h
Merged PRs (30d)
109

Description

Version:
```
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.0.2-git
clang version 14.0.0 (https://github.com/llvm/llvm-project.git 1a929525e86a20d0b3455a400d0dbed40b325a13)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /usr/local/opt/emscripten/libexec/llvm/bin
```
Platform: MacOS Big Sur 11.0.1

Native Compiler Version:
```
clang version 13.0.0
Target: x86_64-apple-darwin20.1.0
Thread model: posix
InstalledDir: /usr/local/bin

```

When I compile the following code with my compiler,I get different results.
```
i=0
j=0
DO
IF ij
END
```
If I use native executable as the compiler , it can be successfully compiled.
If I use WASM to compile , it will throw errors.
I used this command to compile:
```
em++ ../src/compile.cc ../src/lex/lexer.cc ../src/parse/parse.cc ../src/bm3.cc -O3 --no-entry -I../include -o -WASM=0 -o compiler.js -fwasm-exceptions -s EXPORTED_FUNCTIONS=_main
```
The repo is here:[github.com/MCMocoder/BM3-Mathbasic](Repo)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.