diff options
author | Soni L. <EnderMoneyMod@gmail.com> | 2024-09-23 17:01:18 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-23 13:01:18 -0700 |
commit | 0a2a59fae573c2d793501720a2faf986118ee4f4 (patch) | |
tree | a95fd371a30945944121f1ae816491b1daf1031e /.github | |
parent | b287470b53ef074332c4b0056cfc05486a85c4a7 (diff) | |
download | wabt-0a2a59fae573c2d793501720a2faf986118ee4f4.tar.gz wabt-0a2a59fae573c2d793501720a2faf986118ee4f4.tar.bz2 wabt-0a2a59fae573c2d793501720a2faf986118ee4f4.zip |
wasm2c: Use wrappers for function references (#2465)
Clang 17(?) tightened UBSAN checks, so that you now get this:
```
- test/wasm2c/spec/call_indirect.txt
expected error code 0, got 1.
STDERR MISMATCH:
--- expected
+++ actual
@@ -0,0 +1,3 @@
+out/test/wasm2c/spec/call_indirect/call_indirect.0.c:2144:12: runtime error: call to function w2c_call__indirect__0__wasm_f0 through pointer to incorrect function type 'unsigned int (*)(void *)'
+/home/runner/work/wabt/wabt/out/test/wasm2c/spec/call_indirect/call_indirect.0.c:1925: note: w2c_call__indirect__0__wasm_f0 defined here
+SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior out/test/wasm2c/spec/call_indirect/call_indirect.0.c:2144:12
STDOUT MISMATCH:
--- expected
+++ actual
@@ -1 +0,0 @@
-134/134 tests passed.
```
This happens because emitted functions use a typed module instance,
while function references use a `void*` instance. It is UB in C to call
the former with the latter, so clang is correct here.
We had to pick one of two ways to fix this: either emit `void*` wrapper
functions that do the appropriate downcasting for any module functions
that go into a table (potentially including imported functions), or the
approach that takes significantly less effort of changing everything to
`void*` and downcasting internally. ~~We obviously chose the latter.~~
We eventually started emitting wrapper functions.
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/build.yml | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 92b5a088..99ffb6eb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -99,7 +99,7 @@ jobs: sanitize: name: sanitize - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 env: USE_NINJA: "1" CC: "clang" |