Skip to content

wasm-opt crash #8799

@mkustermann

Description

@mkustermann

(At commit 6bb9fe2)

% tar xvf issue2.tar.gz
issue2.wasm
issue2.mjs
pkg/dart2wasm/bin/run_wasm.js

Run with with D8:

% d8  $PWD/pkg/dart2wasm/bin/run_wasm.js -- $PWD/issue2.mjs $PWD/issue2.wasm
% echo $?
0

Optimize with wasm-opt:

% ~/sdk/out/ReleaseX64/wasm-opt --enable-gc --enable-reference-types --enable-multivalue --enable-exception-handling \
    --enable-nontrapping-float-to-int --enable-sign-ext --enable-bulk-memory --enable-threads \
    --enable-simd '--no-inline=*<noInline>*' \
    --closed-world --traps-never-happen --type-unfinalizing \
    -Os --type-ssa --gufa -Os --type-merging -Os --type-finalizing --minimize-rec-groups \
    -g issue2.wasm -o issue2.wasm
libc++abi: terminating due to uncaught exception of type std::out_of_range: unordered_map::at: key not found
zsh: IOT instruction (core dumped)  ~/sdk/out/ReleaseX64/wasm-opt --enable-gc --enable-reference-types

backtrace

(gdb) bt
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
#1  0x00007ffff7c97ddf in __pthread_kill_internal (threadid=<optimized out>, signo=6) at ./nptl/pthread_kill.c:89
#2  0x00007ffff7c40d02 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007ffff7c284b2 in __GI_abort () at ./stdlib/abort.c:77
#4  0x0000555555ce8e56 in __abort_message (format=0x5555555b31fa "terminating due to %s exception of type %s: %s") at ../../../../../../../../../llvm-llvm-project/libcxxabi/src/abort_message.cpp:66
#5  0x0000555555cd20a9 in demangling_terminate_handler () at ../../../../../../../../../llvm-llvm-project/libcxxabi/src/cxa_default_handlers.cpp:72
#6  0x0000555555cd1f93 in std::__terminate (func=0x144376) at ../../../../../../../../../llvm-llvm-project/libcxxabi/src/cxa_handlers.cpp:59
#7  0x0000555555ce9fd6 in __cxxabiv1::failed_throw (exception_header=exception_header@entry=0x555555dc3250) at ../../../../../../../../../llvm-llvm-project/libcxxabi/src/cxa_exception.cpp:152
#8  0x0000555555ce9fc0 in __cxa_throw (thrown_object=0x555555dc32d0, tinfo=0x555555d27438 <typeinfo for std::out_of_range>, dest=<optimized out>) at ../../../../../../../../../llvm-llvm-project/libcxxabi/src/cxa_exception.cpp:301
#9  0x000055555569b6b8 in std::__2::__throw_out_of_range[abi:nqe230000](char const*) (__msg=0x5555555ba7ee "unordered_map::at: key not found") at ../../buildtools/linux-x64/clang/bin/../include/c++/v1/stdexcept:251
#10 0x000055555572ed81 in std::__2::unordered_map<wasm::RecGroup, unsigned long, std::__2::hash<wasm::RecGroup>, std::__2::equal_to<wasm::RecGroup>, std::__2::allocator<std::__2::pair<wasm::RecGroup const, unsigned long> > >::at
    (this=<optimized out>, __k=...) at ../../buildtools/linux-x64/clang/bin/../include/c++/v1/unordered_map:1613
#11 0x0000555555777d23 in sortOfImpl<std::__2::__wrap_iter<std::__2::pair<wasm::HeapType, wasm::SmallVector<wasm::HeapType, 1ul> >*>, std::__2::vector<unsigned int, std::__2::allocator<unsigned int> > (&)(std::__2::vector<std::__2
::vector<unsigned int, std::__2::allocator<unsigned int> >, std::__2::allocator<std::__2::vector<unsigned int, std::__2::allocator<unsigned int> > > > const&), wasm::TopologicalSort::sort> (begin=..., end=...)
    at ../../third_party/binaryen/src/src/support/topological_sort.h:75
#12 0x0000555555773dcd in wasm::TopologicalSort::sortOf<std::__2::__wrap_iter<std::__2::pair<wasm::HeapType, wasm::SmallVector<wasm::HeapType, 1ul> >*> > (begin=..., end=...)
    at ../../third_party/binaryen/src/src/support/topological_sort.h:88
#13 wasm::GlobalTypeRewriter::getSortedTypes (this=<optimized out>, preds=...) at ./../../third_party/binaryen/src/src/ir/type-updating.cpp:97
#14 0x0000555555859086 in wasm::TypeMapper::map (this=0x7fffffffad40) at ../../third_party/binaryen/src/src/ir/type-updating.h:486
#15 0x0000555555b4154b in wasm::(anonymous namespace)::TypeMerging::applyMerges (this=0x555555d744c0) at ./../../third_party/binaryen/src/src/passes/TypeMerging.cpp:645
#16 wasm::(anonymous namespace)::TypeMerging::run (this=0x555555d744c0, module_=<optimized out>) at ./../../third_party/binaryen/src/src/passes/TypeMerging.cpp:294
#17 0x0000555555b80392 in wasm::PassRunner::runPass (pass=0x555555d744c0, this=<optimized out>) at ./../../third_party/binaryen/src/src/passes/pass.cpp:1022
#18 wasm::PassRunner::run (this=this@entry=0x7fffffffb238) at ./../../third_party/binaryen/src/src/passes/pass.cpp:981
#19 0x00005555556d633d in wasm::OptimizationOptions::runPasses(wasm::Module&)::{lambda()#1}::operator()() const (this=<optimized out>) at ../../third_party/binaryen/src/src/tools/optimization-options.h:408
#20 wasm::OptimizationOptions::runPasses (this=0x7fffffffbe58, wasm=...) at ../../third_party/binaryen/src/src/tools/optimization-options.h:418
#21 0x0000555555695ab5 in main::$_25::operator() (this=this@entry=0x7fffffffb7b0) at ./../../third_party/binaryen/src/src/tools/wasm-opt.cpp:424
#22 0x000055555568bdad in main (argc=<optimized out>, argv=<optimized out>) at ./../../third_party/binaryen/src/src/tools/wasm-opt.cpp:432

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions