Skip to content

longjmp(..., 0) seems broken #21486

@yamt

Description

@yamt

longjmp(..., 0) seems broken.
a simplest fix would be something like yamt/garbage@3926373

Version of emscripten/emsdk:
installed with homebrew:

emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.50-git
clang version 18.0.0
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /usr/local/Cellar/emscripten/3.1.50/libexec/llvm/bin

Failing command line in full:

  1. modify https://github.com/yamt/garbage/blob/74c397a5edd9d2bd69138d904464fc7e3f0a7291/wasm/longjmp/a.c#L166 to unskip the test
  2. run test_emcc.sh in the same directory

Full link command and output with -v appended:

 /usr/local/Cellar/emscripten/3.1.50/libexec/llvm/bin/clang -target wasm32-unknown-emscripten -fignore-exceptions -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -wasm-enable-sjlj -mllvm -disable-lsr --sysroot=/usr/local/Cellar/emscripten/3.1.50/libexec/cache/sysroot -DEMSCRIPTEN -Werror=implicit-function-declaration -Xclang -iwithsysroot/include/fakesdl -Xclang -iwithsysroot/include/compat -v -Os a.c -c -o /var/folders/74/hw1sphgx0lv63q6pq_n5grw00000gn/T/emscripten_temp_0i7uh0s_/a_0.o
clang version 18.0.0
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /usr/local/Cellar/emscripten/3.1.50/libexec/llvm/bin
 (in-process)
 "/usr/local/Cellar/emscripten/3.1.50/libexec/llvm/bin/clang-18" -cc1 -triple wasm32-unknown-emscripten -emit-obj -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name a.c -mrelocation-model static -mframe-pointer=none -ffp-contract=on -fno-rounding-math -mconstructor-aliases -target-feature +exception-handling -exception-model=wasm -target-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/Users/yamamoto/git/garbage/wasm/longjmp -target-linker-version 820.1 -v -fcoverage-compilation-dir=/Users/yamamoto/git/garbage/wasm/longjmp -resource-dir /usr/local/Cellar/emscripten/3.1.50/libexec/llvm/lib/clang/18 -D EMSCRIPTEN -isysroot /usr/local/Cellar/emscripten/3.1.50/libexec/cache/sysroot -internal-isystem /usr/local/Cellar/emscripten/3.1.50/libexec/llvm/lib/clang/18/include -internal-isystem /usr/local/Cellar/emscripten/3.1.50/libexec/cache/sysroot/include/wasm32-emscripten -internal-isystem /usr/local/Cellar/emscripten/3.1.50/libexec/cache/sysroot/include -Os -Werror=implicit-function-declaration -ferror-limit 19 -fvisibility=default -fgnuc-version=4.2.1 -fignore-exceptions -fcolor-diagnostics -vectorize-loops -vectorize-slp -iwithsysroot/include/fakesdl -iwithsysroot/include/compat -mllvm -combiner-global-alias-analysis=false -mllvm -wasm-enable-sjlj -mllvm -disable-lsr -o /var/folders/74/hw1sphgx0lv63q6pq_n5grw00000gn/T/emscripten_temp_0i7uh0s_/a_0.o -x c a.c
clang -cc1 version 18.0.0 based upon LLVM 18.0.0git default target x86_64-apple-darwin21.6.0
ignoring nonexistent directory "/usr/local/Cellar/emscripten/3.1.50/libexec/cache/sysroot/include/wasm32-emscripten"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/Cellar/emscripten/3.1.50/libexec/cache/sysroot/include/fakesdl
 /usr/local/Cellar/emscripten/3.1.50/libexec/cache/sysroot/include/compat
 /usr/local/Cellar/emscripten/3.1.50/libexec/llvm/lib/clang/18/include
 /usr/local/Cellar/emscripten/3.1.50/libexec/cache/sysroot/include
End of search list.
 /usr/local/Cellar/emscripten/3.1.50/libexec/llvm/bin/clang -target wasm32-unknown-emscripten -fignore-exceptions -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -wasm-enable-sjlj -mllvm -disable-lsr --sysroot=/usr/local/Cellar/emscripten/3.1.50/libexec/cache/sysroot -DEMSCRIPTEN -Werror=implicit-function-declaration -Xclang -iwithsysroot/include/fakesdl -Xclang -iwithsysroot/include/compat -v -Os lib.c -c -o /var/folders/74/hw1sphgx0lv63q6pq_n5grw00000gn/T/emscripten_temp_0i7uh0s_/lib_1.o
clang version 18.0.0
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /usr/local/Cellar/emscripten/3.1.50/libexec/llvm/bin
 (in-process)
 "/usr/local/Cellar/emscripten/3.1.50/libexec/llvm/bin/clang-18" -cc1 -triple wasm32-unknown-emscripten -emit-obj -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name lib.c -mrelocation-model static -mframe-pointer=none -ffp-contract=on -fno-rounding-math -mconstructor-aliases -target-feature +exception-handling -exception-model=wasm -target-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/Users/yamamoto/git/garbage/wasm/longjmp -target-linker-version 820.1 -v -fcoverage-compilation-dir=/Users/yamamoto/git/garbage/wasm/longjmp -resource-dir /usr/local/Cellar/emscripten/3.1.50/libexec/llvm/lib/clang/18 -D EMSCRIPTEN -isysroot /usr/local/Cellar/emscripten/3.1.50/libexec/cache/sysroot -internal-isystem /usr/local/Cellar/emscripten/3.1.50/libexec/llvm/lib/clang/18/include -internal-isystem /usr/local/Cellar/emscripten/3.1.50/libexec/cache/sysroot/include/wasm32-emscripten -internal-isystem /usr/local/Cellar/emscripten/3.1.50/libexec/cache/sysroot/include -Os -Werror=implicit-function-declaration -ferror-limit 19 -fvisibility=default -fgnuc-version=4.2.1 -fignore-exceptions -fcolor-diagnostics -vectorize-loops -vectorize-slp -iwithsysroot/include/fakesdl -iwithsysroot/include/compat -mllvm -combiner-global-alias-analysis=false -mllvm -wasm-enable-sjlj -mllvm -disable-lsr -o /var/folders/74/hw1sphgx0lv63q6pq_n5grw00000gn/T/emscripten_temp_0i7uh0s_/lib_1.o -x c lib.c
clang -cc1 version 18.0.0 based upon LLVM 18.0.0git default target x86_64-apple-darwin21.6.0
ignoring nonexistent directory "/usr/local/Cellar/emscripten/3.1.50/libexec/cache/sysroot/include/wasm32-emscripten"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/Cellar/emscripten/3.1.50/libexec/cache/sysroot/include/fakesdl
 /usr/local/Cellar/emscripten/3.1.50/libexec/cache/sysroot/include/compat
 /usr/local/Cellar/emscripten/3.1.50/libexec/llvm/lib/clang/18/include
 /usr/local/Cellar/emscripten/3.1.50/libexec/cache/sysroot/include
End of search list.
 /usr/local/Cellar/emscripten/3.1.50/libexec/llvm/bin/clang --version
 /usr/local/Cellar/emscripten/3.1.50/libexec/llvm/bin/wasm-ld -o a.out.wasm /var/folders/74/hw1sphgx0lv63q6pq_n5grw00000gn/T/emscripten_temp_0i7uh0s_/a_0.o /var/folders/74/hw1sphgx0lv63q6pq_n5grw00000gn/T/emscripten_temp_0i7uh0s_/lib_1.o -L/usr/local/Cellar/emscripten/3.1.50/libexec/cache/sysroot/lib/wasm32-emscripten -lGL -lal -lhtml5 -lstubs -lnoexit -lc -ldlmalloc -lcompiler_rt-wasm-sjlj -lc++-noexcept -lc++abi-noexcept -lsockets -mllvm -combiner-global-alias-analysis=false -mllvm -wasm-enable-sjlj -mllvm -disable-lsr -mllvm -exception-model=wasm /var/folders/74/hw1sphgx0lv63q6pq_n5grw00000gn/T/tmpv8io9b3_libemscripten_js_symbols.so --strip-debug --export-if-defined=main --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js --export-if-defined=__stop_em_js --export-if-defined=__main_argc_argv --export=stackSave --export=stackRestore --export=stackAlloc --export=__errno_location --export=__get_temp_ret --export=__set_temp_ret --export=__wasm_call_ctors --export-table -z stack-size=65536 --initial-memory=16777216 --max-memory=16777216 --no-entry --table-base=1 --global-base=1024
 /usr/local/Cellar/emscripten/3.1.50/libexec/llvm/bin/llvm-objcopy a.out.wasm a.out.wasm --remove-section=.debug* --remove-section=producers
 /usr/local/Cellar/emscripten/3.1.50/libexec/binaryen/bin/wasm-emscripten-finalize --dyncalls-i64 --pass-arg=legalize-js-interface-exported-helpers a.out.wasm -o a.out.wasm --detect-features
 /usr/local/opt/node/bin/node /usr/local/Cellar/emscripten/3.1.50/libexec/src/compiler.js /var/folders/74/hw1sphgx0lv63q6pq_n5grw00000gn/T/tmpoo2qqlln.json
 /usr/local/Cellar/emscripten/3.1.50/libexec/binaryen/bin/wasm-opt --strip-target-features --post-emscripten -Os --low-memory-unused --zero-filled-memory --pass-arg=directize-initial-contents-immutable a.out.wasm -o a.out.wasm --mvp-features --enable-exception-handling --enable-mutable-globals --enable-sign-ext
 /usr/local/opt/node/bin/node /usr/local/Cellar/emscripten/3.1.50/libexec/tools/acorn-optimizer.js /var/folders/74/hw1sphgx0lv63q6pq_n5grw00000gn/T/emscripten_temp_0i7uh0s_/a.out.js AJSDCE minifyWhitespace -o /var/folders/74/hw1sphgx0lv63q6pq_n5grw00000gn/T/emscripten_temp_0i7uh0s_/a.out.jso1.js
 /usr/local/opt/node/bin/node /usr/local/Cellar/emscripten/3.1.50/libexec/tools/acorn-optimizer.js /var/folders/74/hw1sphgx0lv63q6pq_n5grw00000gn/T/emcc_acorn_info_it1x5l_l.js emitDCEGraph noPrint
 /usr/local/Cellar/emscripten/3.1.50/libexec/binaryen/bin/wasm-metadce --graph-file=/var/folders/74/hw1sphgx0lv63q6pq_n5grw00000gn/T/emcc_dce_graph_45y1axkk.json a.out.wasm -o a.out.wasm --mvp-features --enable-exception-handling --enable-mutable-globals --enable-sign-ext
 /usr/local/opt/node/bin/node /usr/local/Cellar/emscripten/3.1.50/libexec/tools/acorn-optimizer.js /var/folders/74/hw1sphgx0lv63q6pq_n5grw00000gn/T/emcc_acorn_info_yf68h4x9.js applyDCEGraphRemovals minifyWhitespace -o /var/folders/74/hw1sphgx0lv63q6pq_n5grw00000gn/T/emscripten_temp_0i7uh0s_/a.out.jso2.js
 /usr/local/opt/node/bin/node /usr/local/Cellar/emscripten/3.1.50/libexec/tools/acorn-optimizer.js /var/folders/74/hw1sphgx0lv63q6pq_n5grw00000gn/T/emscripten_temp_0i7uh0s_/a.out.jso2.js AJSDCE minifyWhitespace -o /var/folders/74/hw1sphgx0lv63q6pq_n5grw00000gn/T/emscripten_temp_0i7uh0s_/a.out.jso3.js
 /usr/local/Cellar/emscripten/3.1.50/libexec/binaryen/bin/wasm-opt --minify-imports-and-exports-and-modules a.out.wasm -o a.out.wasm --mvp-features --enable-exception-handling --enable-mutable-globals --enable-sign-ext

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions