Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emcc crashes with SIMD without optimization #10563

Closed
nemequ opened this issue Feb 25, 2020 · 4 comments
Closed

emcc crashes with SIMD without optimization #10563

nemequ opened this issue Feb 25, 2020 · 4 comments
Assignees
Labels

Comments

@nemequ
Copy link

nemequ commented Feb 25, 2020

emcc crashes when attempting to compile the tests int SIMDe with SIMD but without optimizations (-msimd128 -s SIMD=1 -O0). Here is the error message:

Stack dump:
0.	Program arguments: /home/nemequ/emsdk/upstream/bin/clang -target wasm32-unknown-emscripten -D__EMSCRIPTEN_major__=1 -D__EMSCRIPTEN_minor__=39 -D__EMSCRIPTEN_tiny__=8 -D_LIBCPP_ABI_VERSION=2 -Dunix -D__unix -D__unix__ -Werror=implicit-function-declaration -Xclang -nostdsysteminc -Xclang -isystem/home/nemequ/emsdk/upstream/emscripten/system/include/libcxx -Xclang -isystem/home/nemequ/emsdk/upstream/emscripten/system/lib/libcxxabi/include -Xclang -isystem/home/nemequ/emsdk/upstream/emscripten/system/include/compat -Xclang -isystem/home/nemequ/emsdk/upstream/emscripten/system/include -Xclang -isystem/home/nemequ/emsdk/upstream/emscripten/system/include/libc -Xclang -isystem/home/nemequ/emsdk/upstream/emscripten/system/lib/libc/musl/arch/emscripten -Xclang -isystem/home/nemequ/emsdk/upstream/emscripten/system/local/include -Xclang -isystem/home/nemequ/.emscripten_cache/wasm/include -DSIMDE_BUILD_CPP_TESTS -DSIMDE_NO_NATIVE -I/home/nemequ/simde/test/.. -msimd128 -DSIMDE_ENABLE_OPENMP -fopenmp-simd -gline-tables-only -std=gnu99 -c -DEMSCRIPTEN -fignore-exceptions -msimd128 /home/nemequ/simde/test/x86/mmx.c -Xclang -isystem/home/nemequ/emsdk/upstream/emscripten/system/include/SDL -c -o CMakeFiles/simde-test-emul.dir/x86/mmx.c.o -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr 
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module '/home/nemequ/simde/test/x86/mmx.c'.
4.	Running pass 'WebAssembly Instruction Selection' on function '@test_simde_mm_set1_pi8'
 #0 0x00007f1d4636d694 PrintStackTraceSignalHandler(void*) (/home/nemequ/emsdk/upstream/bin/../lib/libLLVM-11git.so+0x745694)
 #1 0x00007f1d4636b20e llvm::sys::RunSignalHandlers() (/home/nemequ/emsdk/upstream/bin/../lib/libLLVM-11git.so+0x74320e)
 #2 0x00007f1d4636c804 llvm::sys::CleanupOnSignal(unsigned long) (/home/nemequ/emsdk/upstream/bin/../lib/libLLVM-11git.so+0x744804)
 #3 0x00007f1d462a58e3 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) (/home/nemequ/emsdk/upstream/bin/../lib/libLLVM-11git.so+0x67d8e3)
 #4 0x00007f1d462a5a1c CrashRecoverySignalHandler(int) (/home/nemequ/emsdk/upstream/bin/../lib/libLLVM-11git.so+0x67da1c)
 #5 0x00007f1d45a1b890 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #6 0x00007f1d47f30186 llvm::WebAssemblyTargetLowering::LowerSIGN_EXTEND_INREG(llvm::SDValue, llvm::SelectionDAG&) const (/home/nemequ/emsdk/upstream/bin/../lib/libLLVM-11git.so+0x2308186)
 #7 0x00007f1d47f2e3e9 llvm::WebAssemblyTargetLowering::LowerOperation(llvm::SDValue, llvm::SelectionDAG&) const (/home/nemequ/emsdk/upstream/bin/../lib/libLLVM-11git.so+0x23063e9)
 #8 0x00007f1d469d90b1 (anonymous namespace)::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*) (/home/nemequ/emsdk/upstream/bin/../lib/libLLVM-11git.so+0xdb10b1)
 #9 0x00007f1d469d869a llvm::SelectionDAG::Legalize() (/home/nemequ/emsdk/upstream/bin/../lib/libLLVM-11git.so+0xdb069a)
#10 0x00007f1d46b4d713 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/home/nemequ/emsdk/upstream/bin/../lib/libLLVM-11git.so+0xf25713)
#11 0x00007f1d46b4b77f llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/home/nemequ/emsdk/upstream/bin/../lib/libLLVM-11git.so+0xf2377f)
#12 0x00007f1d46b47e34 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/home/nemequ/emsdk/upstream/bin/../lib/libLLVM-11git.so+0xf1fe34)
#13 0x00007f1d466eb62e llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/home/nemequ/emsdk/upstream/bin/../lib/libLLVM-11git.so+0xac362e)
#14 0x00007f1d464c9f01 llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/nemequ/emsdk/upstream/bin/../lib/libLLVM-11git.so+0x8a1f01)
#15 0x00007f1d464ca208 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/nemequ/emsdk/upstream/bin/../lib/libLLVM-11git.so+0x8a2208)
#16 0x00007f1d464ca940 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/nemequ/emsdk/upstream/bin/../lib/libLLVM-11git.so+0x8a2940)
#17 0x00007f1d43b65752 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (/home/nemequ/emsdk/upstream/bin/../lib/libclang-cpp.so.11git+0x16cd752)
#18 0x00007f1d43e5d3bc clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/home/nemequ/emsdk/upstream/bin/../lib/libclang-cpp.so.11git+0x19c53bc)
#19 0x00007f1d42c6e523 clang::ParseAST(clang::Sema&, bool, bool) (/home/nemequ/emsdk/upstream/bin/../lib/libclang-cpp.so.11git+0x7d6523)
#20 0x00007f1d446a9520 clang::FrontendAction::Execute() (/home/nemequ/emsdk/upstream/bin/../lib/libclang-cpp.so.11git+0x2211520)
#21 0x00007f1d44644c23 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/nemequ/emsdk/upstream/bin/../lib/libclang-cpp.so.11git+0x21acc23)
#22 0x00007f1d4471d450 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/nemequ/emsdk/upstream/bin/../lib/libclang-cpp.so.11git+0x2285450)
#23 0x0000000000410a26 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/nemequ/emsdk/upstream/bin/clang+0x410a26)
#24 0x000000000040ef7c ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) (/home/nemequ/emsdk/upstream/bin/clang+0x40ef7c)
#25 0x00007f1d442ebd32 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const::$_1>(long) (/home/nemequ/emsdk/upstream/bin/../lib/libclang-cpp.so.11git+0x1e53d32)
#26 0x00007f1d462a5801 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/home/nemequ/emsdk/upstream/bin/../lib/libLLVM-11git.so+0x67d801)
#27 0x00007f1d442eb2fe clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const (/home/nemequ/emsdk/upstream/bin/../lib/libclang-cpp.so.11git+0x1e532fe)
#28 0x00007f1d442b8fbb clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const (/home/nemequ/emsdk/upstream/bin/../lib/libclang-cpp.so.11git+0x1e20fbb)
#29 0x00007f1d442b93da clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const (/home/nemequ/emsdk/upstream/bin/../lib/libclang-cpp.so.11git+0x1e213da)
#30 0x00007f1d442d23a8 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) (/home/nemequ/emsdk/upstream/bin/../lib/libclang-cpp.so.11git+0x1e3a3a8)
#31 0x000000000040e739 main (/home/nemequ/emsdk/upstream/bin/clang+0x40e739)
#32 0x00007f1d41789b97 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b97)
#33 0x000000000040bc69 _start (/home/nemequ/emsdk/upstream/bin/clang+0x40bc69)
clang-11: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 11.0.0 (/b/s/w/ir/cache/git/chromium.googlesource.com-external-github.com-llvm-llvm--project bae33a7c5a1f220671e6d99cda21749afe2501a6)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /home/nemequ/emsdk/upstream/bin
clang-11: note: diagnostic msg: PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
clang-11: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-11: note: diagnostic msg: /tmp/mmx-2e8fdf.c
clang-11: note: diagnostic msg: /tmp/mmx-2e8fdf.sh
clang-11: note: diagnostic msg: 

********************
shared:ERROR: '/home/nemequ/emsdk/upstream/bin/clang -target wasm32-unknown-emscripten -D__EMSCRIPTEN_major__=1 -D__EMSCRIPTEN_minor__=39 -D__EMSCRIPTEN_tiny__=8 -D_LIBCPP_ABI_VERSION=2 -Dunix -D__unix -D__unix__ -Werror=implicit-function-declaration -Xclang -nostdsysteminc -Xclang -isystem/home/nemequ/emsdk/upstream/emscripten/system/include/libcxx -Xclang -isystem/home/nemequ/emsdk/upstream/emscripten/system/lib/libcxxabi/include -Xclang -isystem/home/nemequ/emsdk/upstream/emscripten/system/include/compat -Xclang -isystem/home/nemequ/emsdk/upstream/emscripten/system/include -Xclang -isystem/home/nemequ/emsdk/upstream/emscripten/system/include/libc -Xclang -isystem/home/nemequ/emsdk/upstream/emscripten/system/lib/libc/musl/arch/emscripten -Xclang -isystem/home/nemequ/emsdk/upstream/emscripten/system/local/include -Xclang -isystem/home/nemequ/.emscripten_cache/wasm/include -DSIMDE_BUILD_CPP_TESTS -DSIMDE_NO_NATIVE -I/home/nemequ/simde/test/.. -msimd128 -DSIMDE_ENABLE_OPENMP -fopenmp-simd -gline-tables-only -std=gnu99 -c -DEMSCRIPTEN -fignore-exceptions -msimd128 /home/nemequ/simde/test/x86/mmx.c -Xclang -isystem/home/nemequ/emsdk/upstream/emscripten/system/include/SDL -c -o CMakeFiles/simde-test-emul.dir/x86/mmx.c.o -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr' failed (254)

mmx-2e8fdf.c and mmx-2e8fdf.sh

Here is a reduced test case C-Reduce came up with:

typedef char a;
typedef struct {
  a b __attribute__((__vector_size__(8)))
} c;
c d, e;
test_simde_mm_set1_pi8() {
  for (int f;;)
    if (__builtin_expect(d.b[f] == e.b[f], 0))
      ;
}
@stale
Copy link

stale bot commented Mar 19, 2021

This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant.

@stale stale bot added the wontfix label Mar 19, 2021
@tlively
Copy link
Member

tlively commented Mar 20, 2021

Oh! I don't think I ever saw this. Will investigate, unless @nemequ knows this has been resolved in the meantime.

@stale stale bot removed the wontfix label Mar 20, 2021
@nemequ
Copy link
Author

nemequ commented Mar 20, 2021

Looks like it has been resolved, though I'm not sure when. Thanks, though!

@nemequ nemequ closed this as completed Mar 20, 2021
@mr-c
Copy link
Contributor

mr-c commented Mar 22, 2024

Git bisecting this, I can confirm that this issue was fixed in https://chromium.googlesource.com/emscripten-releases/+/de6c0a3d27ad34744fb224a080be36f5597d9c59 which was first incorporated into a normal emscripten release starting with version 1.39.17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants