[llvm-bugs] [Bug 43260] New: emscripten exception with new LLVM backend

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 9 15:57:37 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=43260

            Bug ID: 43260
           Summary: emscripten exception with new LLVM backend
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hacker at linux.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

When compiling [sphincs.js](https://github.com/cyph/sphincs.js) with emscripten
latest-upstream, I get the following error. Specifically, the problem is caused
by using `WASM=1` with anything other than `-O0`.

Not sure if this is more of an llvm or emscripten problem, so I submitted to
both. emscripten issue:
https://github.com/emscripten-core/emscripten/issues/9413

```
clang-10:
/b/s/w/ir/cache/builder/emscripten-releases/llvm-project/llvm/lib/Analysis/ScalarEvolution.cpp:4069:
const llvm::SCEV *llvm::ScalarEvolution::getNoopOrZeroExtend(const llvm::SCEV
*, llvm::Type *): Assertion `getTypeSizeInBits(SrcTy) <= getTypeSizeInBits(Ty)
&& "getNoopOrZeroExtend cannot truncate!"' failed.
Stack dump:
0.      Program arguments: /home/gibson/emsdk/upstream/bin/clang-10 -cc1
-triple wasm32-unknown-emscripten -emit-obj -disable-free -main-file-name
sign.c -mrelocation-model static -mthread-model posix -mframe-pointer=none
-masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu generic
-fvisibility hidden -dwarf-column-info -debugger-tuning=gdb
-coverage-notes-file /tmp/emscripten_temp__jRzu7/sign_8.gcno -resource-dir
/home/gibson/emsdk/upstream/lib/clang/10.0.0 -include
c_src/crypto_stream/chacha12/e/ref/namespace.h -D __EMSCRIPTEN_major__=1 -D
__EMSCRIPTEN_minor__=38 -D __EMSCRIPTEN_tiny__=43 -D _LIBCPP_ABI_VERSION=2 -D
unix -D __unix -D __unix__ -D EMSCRIPTEN -I
libsodium/src/libsodium/include/sodium -I openssl/include -I c_src -I
c_src/include -I c_src/crypto_stream/chacha12/e/ref -internal-isystem
/home/gibson/emsdk/upstream/lib/clang/10.0.0/include -internal-isystem
/include/wasm32-emscripten -internal-isystem /include -O3
-Werror=implicit-function-declaration -fdebug-compilation-dir /cyph/sphincs.js
-ferror-limit 19 -fmessage-length 0 -fobjc-runtime=gnustep -fno-common
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-nostdsysteminc
-isystem/home/gibson/emsdk/upstream/emscripten/system/include/libcxx
-isystem/home/gibson/emsdk/upstream/emscripten/system/lib/libcxxabi/include
-isystem/home/gibson/emsdk/upstream/emscripten/system/include/compat
-isystem/home/gibson/emsdk/upstream/emscripten/system/include
-isystem/home/gibson/emsdk/upstream/emscripten/system/include/libc
-isystem/home/gibson/emsdk/upstream/emscripten/system/lib/libc/musl/arch/emscripten
-isystem/home/gibson/emsdk/upstream/emscripten/system/local/include
-isystem/home/gibson/emsdk/upstream/emscripten/system/include/SDL -mllvm
-combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm
-disable-lsr -o /tmp/emscripten_temp__jRzu7/sign_8.o -x c
c_src/crypto_sign/sphincs256/ref/sign.c
1.      <eof> parser at end of file
2.      Per-module optimization passes
3.      Running pass 'CallGraph Pass Manager' on module
'c_src/crypto_sign/sphincs256/ref/sign.c'.
4.      Running pass 'Loop Pass Manager' on function
'@crypto_sign_sphincs_open'
5.      Running pass 'Recognize loop idioms' on basic block '%for.body72'
 #0 0x00007f8fdb7f5bd4 PrintStackTraceSignalHandler(void*)
(/home/gibson/emsdk/upstream/bin/../lib/libLLVM-10svn.so+0x6e7bd4)
 #1 0x00007f8fdb7f395e llvm::sys::RunSignalHandlers()
(/home/gibson/emsdk/upstream/bin/../lib/libLLVM-10svn.so+0x6e595e)
 #2 0x00007f8fdb7f5e88 SignalHandler(int)
(/home/gibson/emsdk/upstream/bin/../lib/libLLVM-10svn.so+0x6e7e88)
 #3 0x00007f8fdb0f4730 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12730)
 #4 0x00007f8fd7b5e7bb raise (/lib/x86_64-linux-gnu/libc.so.6+0x377bb)
 #5 0x00007f8fd7b49535 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22535)
 #6 0x00007f8fd7b4940f (/lib/x86_64-linux-gnu/libc.so.6+0x2240f)
 #7 0x00007f8fd7b57102 (/lib/x86_64-linux-gnu/libc.so.6+0x30102)
 #8 0x00007f8fdca0d51a
(/home/gibson/emsdk/upstream/bin/../lib/libLLVM-10svn.so+0x18ff51a)
 #9 0x00007f8fdc507961 (anonymous
namespace)::LoopIdiomRecognize::detectBCmpIdiom(llvm::ICmpInst*&,
llvm::CmpInst*&, llvm::LoadInst*&, llvm::LoadInst*&, llvm::SCEV const*&,
llvm::SCEV const*&, llvm::SCEV const*&) const
(/home/gibson/emsdk/upstream/bin/../lib/libLLVM-10svn.so+0x13f9961)
#10 0x00007f8fdc4fce6c (anonymous
namespace)::LoopIdiomRecognize::runOnNoncountableLoop()
(/home/gibson/emsdk/upstream/bin/../lib/libLLVM-10svn.so+0x13eee6c)
#11 0x00007f8fdc4f9d12 (anonymous
namespace)::LoopIdiomRecognizeLegacyPass::runOnLoop(llvm::Loop*,
llvm::LPPassManager&)
(/home/gibson/emsdk/upstream/bin/../lib/libLLVM-10svn.so+0x13ebd12)
#12 0x00007f8fdc982c32 llvm::LPPassManager::runOnFunction(llvm::Function&)
(/home/gibson/emsdk/upstream/bin/../lib/libLLVM-10svn.so+0x1874c32)
#13 0x00007f8fdb943b4c llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/gibson/emsdk/upstream/bin/../lib/libLLVM-10svn.so+0x835b4c)
#14 0x00007f8fdc89af19 (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
(/home/gibson/emsdk/upstream/bin/../lib/libLLVM-10svn.so+0x178cf19)
#15 0x00007f8fdb944590 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/gibson/emsdk/upstream/bin/../lib/libLLVM-10svn.so+0x836590)
#16 0x00007f8fd9497bca 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/gibson/emsdk/upstream/bin/../lib/libclang-cpp.so.10svn+0x148cbca)
#17 0x00007f8fd973d3b3
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/gibson/emsdk/upstream/bin/../lib/libclang-cpp.so.10svn+0x17323b3)
#18 0x00007f8fd8717e63 clang::ParseAST(clang::Sema&, bool, bool)
(/home/gibson/emsdk/upstream/bin/../lib/libclang-cpp.so.10svn+0x70ce63)
#19 0x00007f8fd9ecc5e8 clang::FrontendAction::Execute()
(/home/gibson/emsdk/upstream/bin/../lib/libclang-cpp.so.10svn+0x1ec15e8)
#20 0x00007f8fd9e73552
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/gibson/emsdk/upstream/bin/../lib/libclang-cpp.so.10svn+0x1e68552)
#21 0x00007f8fd9f37fbd
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/gibson/emsdk/upstream/bin/../lib/libclang-cpp.so.10svn+0x1f2cfbd)
#22 0x000000000041052f cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/gibson/emsdk/upstream/bin/clang-10+0x41052f)
#23 0x000000000040ea65 main (/home/gibson/emsdk/upstream/bin/clang-10+0x40ea65)
#24 0x00007f8fd7b4b09b __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2409b)
#25 0x000000000040ba59 _start
(/home/gibson/emsdk/upstream/bin/clang-10+0x40ba59)
clang-10: error: unable to execute command: Aborted
clang-10: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 10.0.0
(/b/s/w/ir/cache/git/chromium.googlesource.com-external-github.com-llvm-llvm--project
4e71702cd4ab2c77aaa753770e99526085e5e6eb)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /home/gibson/emsdk/upstream/bin
clang-10: 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-10: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-10: note: diagnostic msg: /tmp/sign-531d15.c
clang-10: note: diagnostic msg: /tmp/sign-531d15.sh
clang-10: note: diagnostic msg:

********************
shared:ERROR: '/home/gibson/emsdk/upstream/bin/clang -target
wasm32-unknown-emscripten -D__EMSCRIPTEN_major__=1 -D__EMSCRIPTEN_minor__=38
-D__EMSCRIPTEN_tiny__=43 -D_LIBCPP_ABI_VERSION=2 -Dunix -D__unix -D__unix__
-Werror=implicit-function-declaration -Xclang -nostdsysteminc -Xclang
-isystem/home/gibson/emsdk/upstream/emscripten/system/include/libcxx -Xclang
-isystem/home/gibson/emsdk/upstream/emscripten/system/lib/libcxxabi/include
-Xclang -isystem/home/gibson/emsdk/upstream/emscripten/system/include/compat
-Xclang -isystem/home/gibson/emsdk/upstream/emscripten/system/include -Xclang
-isystem/home/gibson/emsdk/upstream/emscripten/system/include/libc -Xclang
-isystem/home/gibson/emsdk/upstream/emscripten/system/lib/libc/musl/arch/emscripten
-Xclang -isystem/home/gibson/emsdk/upstream/emscripten/system/local/include
-DEMSCRIPTEN -O3 -Ilibsodium/src/libsodium/include/sodium -Iopenssl/include
-Ic_src -Ic_src/include -Ic_src/crypto_stream/chacha12/e/ref -include
c_src/crypto_stream/chacha12/e/ref/namespace.h
c_src/crypto_sign/sphincs256/ref/sign.c -Xclang
-isystem/home/gibson/emsdk/upstream/emscripten/system/include/SDL -c -o
/tmp/emscripten_temp__jRzu7/sign_8.o -mllvm
-combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm
-disable-lsr' failed (254)
```

[sign-531d15.c.txt](https://github.com/emscripten-core/emscripten/files/3588279/sign-531d15.c.txt)
[sign-531d15.sh.txt](https://github.com/emscripten-core/emscripten/files/3588280/sign-531d15.sh.txt)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190909/b28dec8e/attachment.html>


More information about the llvm-bugs mailing list