emscripten-core / emscripten-core/emscripten

Running the compiled wasm program will cause an error:'memory fault'

Open
#21,079 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.51 (c0c2ca1314672a25699846b4663701bcb6f69cca)
clang version 18.0.0git (https://github.com/llvm/llvm-project f2464ca317bfeeedddb7cbdea3c2c8ec487890bb)
wasmtime-cli 16.0.0 (6613acd1e 2023-12-20)
wasmedge version 0.13.5

the source code is:
[fasta.gcc-2.txt](https://github.com/emscripten-core/emscripten/files/13930523/fasta.gcc-2.txt)

the command is:
emcc fasta.gcc-2.c -o fasta.gcc-2.wasm
wasmtime fasta.gcc-2.wasm 1000

then it shows:
Error: failed to run main module `fasta.gcc-2.wasm`

Caused by:
0: failed to invoke command default
1: error while executing at wasm backtrace:
0: 0xa09 - !
1: 0x905 - !
2: 0x144b - !
3: 0x13c5 - !
2: memory fault at wasm address 0x10000fdec in linear memory of size 0x1000000
3: wasm trap: out of bounds memory access

if I use wasmedge to run fasta.gcc-2.wasm, it also shows:
wasmedge fasta.gcc-2.wasm 1000
[error] execution failed: out of bounds memory access, Code: 0x88
[error] Accessing offset from: 0x10000fdec to: 0x10000fdef , Out of boundary: 0x00ffffff
[error] In instruction: i32.store (0x36) , Bytecode offset: 0x00000a09
[error] When executing function name: "_start"

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.