openvibers/source.openvibe.games Commits

Fix clang-cl QuickJS crash on first JS_Eval (-fno-strict-aliasing)

CO Copilot committed 2 Jul 2026 · 673565c598 · 1 file, +7 −1

Isolated via a native Linux harness: ovjs_core.c + all the JS files load
and run perfectly under gcc (hook->gamemode->bridge->module/net/addon->
command->timer->base->client.js, require('ov-leftpad')=0009, hooks fire).
So the client crash at "loading js/core/hook.js" was NOT a logic bug —
it's the clang-cl Windows QuickJS build miscompiling the interpreter at
/O2 because it lacked -fno-strict-aliasing (which QuickJS requires; the
Linux SDK build sets it globally, hence Linux worked). Add
/clang:-fno-strict-aliasing and /clang:-fwrapv to the clang-cl flags.

Changes

ddiff --git a/tools/build-quickjs-lib-windows.ps1 b/tools/build-quickjs-lib-windows.ps1
iindex 25bee57..367d482 100644
---- a/tools/build-quickjs-lib-windows.ps1
++++ b/tools/build-quickjs-lib-windows.ps1
@@@ -250,7 +250,13 @@ if ($ClangCl) {
"/I$CompatInclude",
"/I$SdkQjs",
'/clang:-std=gnu11',
-- '/clang:-Wno-everything'
++ '/clang:-Wno-everything',
++ # QuickJS REQUIRES these or -O2 miscompiles the interpreter and crashes on
++ # the first JS_Eval (the Linux SDK build sets them globally, which is why
++ # Linux works). -fno-strict-aliasing is the critical one; -fwrapv matches
++ # QuickJS's signed-overflow assumptions.
++ '/clang:-fno-strict-aliasing',
++ '/clang:-fwrapv'
)
} else {
$Compiler = $ClExe