emscripten-core / emscripten-core/emscripten

runtime_debug/checkInt overly aggressive when ASSERTIONS=2

オープン
#19,655 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
C++
スター
27.6k
フォーク
3.6k
平均マージ
1日 14時間
マージ済み PR(30日)
125

説明

When I run my emscripten app for debugging after compiling it with ASSERTIONS=2, the app aborts after calling stat, and after calling fillMouseEventData.

- In stat, the stat.rdev instance member is 'undefined', which causes an abort. (library_workerfs.js:85)
- In fillMouseEventData, 'e.clientX - rect.left' resolves to a float, not an int, which also causes an abort. (library_html5.js:439)

I believe this pull request is the breaking change for me: https://github.com/emscripten-core/emscripten/pull/19251

I've reverted to ASSERTIONS=1, but I'd love to debug with a higher assertion level.

**Console output**
t RuntimeError: Aborted(Assertion failed: attempt to write non-integer (undefined) into integer heap)
at abort (cskyclasses-debug.js:836:10)
at assert (cskyclasses-debug.js:615:3)
at checkInt (cskyclasses-debug.js:1074:2)
at checkInt32 (cskyclasses-debug.js:1085:27)
at setValue_safe (cskyclasses-debug.js:5460:3)
at SAFE_HEAP_STORE (cskyclasses-debug.js:564:2)
at Object.doStat (cskyclasses-debug.js:4697:3)
at ___syscall_stat64 (cskyclasses-debug.js:5807:19)
at fstatat (fstatat.c:148:9)
at stat (stat.c:6:9)

**Version of emscripten/emsdk:**
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.41 (71634e036d20209a5d81c2b2171e145b44de1e12)
clang version 17.0.0 (https://github.com/llvm/llvm-project 88421ea973916e60c34beb26597a5fc33f83dd8f)
Target: wasm32-unknown-emscripten
Thread model: posix

**Full link command and output with `-v` appended:**
Output of link is attached.
[ssww_emcc_link_log_2023-06-19.txt](https://github.com/emscripten-core/emscripten/files/11807360/ssww_emcc_link_log_2023-06-19.txt)

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

生成された runtime の checkInt から始め、library_workerfs.js:85 と library_html5.js:439 の報告された箇所を調べます。ASSERTIONS=2 で stat と fillMouseEventData のパスを再現します。報告された undefined または float の値でこれらの呼び出しが中断されなくなれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, wasm
領域
compilers
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。