`rts_clearMemory` causes "ASSERTION FAILED: file rts/sm/Storage.c, line 1216" on wasm32-wasi with "+RTS -DS"
Summary
Following these instructions using wizer, when I use RTS options -DS, I get this error:
test.wasm: internal error: ASSERTION FAILED: file rts/sm/Storage.c, line 1216
(GHC version 9.12.2.20250327 for wasm32_unknown_wasi)
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
If I remove rts_clearMemory at the end of Test_c.c then it works.
repro code (detailed instructions below): https://gist.github.com/HMPerson1/73aa46b611ac6cbcc98d81cb8394ad8d
Steps to reproduce
Use the ghc-wasm-meta nix flake:
nix shell 'gitlab:haskell-wasm/ghc-wasm-meta?host=gitlab.haskell.org'
Run:
git clone https://gist.github.com/HMPerson1/73aa46b611ac6cbcc98d81cb8394ad8d.git
cd 73aa46b611ac6cbcc98d81cb8394ad8d
wasm32-wasi-ghc -c Test.hs
wasm32-wasi-ghc -debug Test.hs Test_c.c -o test.wasm -no-hs-main -optl-mexec-model=reactor -optl-Wl,--export=fib
wizer --allow-wasi test.wasm -o test.wizer.wasm
node js-driver.js
Expected behavior
What do you expect the reproducer described above to do?
not crash
Environment
-
GHC version used:
$ wasm32-wasi-ghc --version The Glorious Glasgow Haskell Compilation System, version 9.12.2.20250327 -
ghc-wasm-metarevision:$ nix flake metadata 'gitlab:haskell-wasm/ghc-wasm-meta?host=gitlab.haskell.org' Resolved URL: gitlab:haskell-wasm/ghc-wasm-meta Locked URL: gitlab:haskell-wasm/ghc-wasm-meta/694c011879c4630dfcbcea52c6c0a06404061a9b?narHash=sha256-Tktjxb3hXyXcYwT6othEJH2ja45jMI/4N/9Cdju6t2Y%3D Path: /nix/store/k8pzcqyb9cgx12pnb66q84xrjkrn1cwm-source Revision: 694c011879c4630dfcbcea52c6c0a06404061a9b Last modified: 2025-05-01 13:36:17 Fingerprint: 56e0cc94db58f29c4b0f201c9377fd8e6428d0b6686905e725324d522d27566e Inputs: ├───flake-utils: github:numtide/flake-utils/11707dc2f618dd54ca8739b309ec4fc024de578b?narHash=sha256-l0KFg5HjrsfsO/JpG%2Br7fRrqm12kzFHyUHqHCVpMMbI%3D (2024-11-13 21:27:16) │ └───systems: github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e?narHash=sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768%3D (2023-04-09 08:27:08) └───nixpkgs: github:NixOS/nixpkgs/c8cd81426f45942bb2906d5ed2fe21d2f19d95b7?narHash=sha256-tzCdyIJj9AjysC3OuKA%2BtMD/kDEDAF9mICPDU7ix0JA%3D (2025-04-08 07:41:42)
Optional:
- Operating System:
- host: Ubuntu 22.04.5 LTS on WSL2
- target: n/a
- System Architecture:
- host: amd64
- target: wasm32-wasi
Edited by HMPerson1