Created attachment 1316070 [details] preprocessed integer.cpp, integer-05cbef.cpp, and integer-05cbef.sh I'm testing a patch that uses _addcarryx_u64 intrinsics to speedup some big integer math. The machine is a 6th gen Core i5 (Skylake), so it has the ADX extensions. Intel ICC generates beautiful code that utilizes adcx. GCC 6.4 still produces the old crappy add/adc code. Clang 3.9 panics. I have not been able to reduce the crash to a minimal test case. My simple reduced test cases compile fine. The source file in question, integer.cpp, is an awful monstrosity. **************************************** Regarding: 3. Running pass 'X86 Assembly / Object Emitter' on function @_ZN8CryptoPP7ADX_AddEmPmPKmS2_' ADX_Add is the new function I am adding/testing. It is the patch that's being tested. (ICC and GCC tested good). #if CRYPTOPP_INTEGER_ADX CRYPTOPP_NAKED int CRYPTOPP_FASTCALL ADX_Add(size_t N, word *C, const word *A, const word *B) { long long unsigned int* CC = reinterpret_cast<long long unsigned int*>(C); const long long unsigned int* BB = reinterpret_cast<const long long unsigned int*>(B); const long long unsigned int* AA = reinterpret_cast<const long long unsigned int*>(A); byte carry = 0; for (size_t i = 0; i < N; ++i) carry = _addcarryx_u64(carry, AA[i], BB[i], &CC[i]); return carry; } #endif **************************************** skylake:cryptopp-fork$ clang++ -DNDEBUG -g2 -O3 -fPIC -march=native --save-temps integer.cpp 0 libLLVM-3.9.so 0x00007fd07d159338 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 56 1 libLLVM-3.9.so 0x00007fd07d15745e llvm::sys::RunSignalHandlers() + 62 2 libLLVM-3.9.so 0x00007fd07d15759a 3 libpthread.so.0 0x00007fd07b0df5b0 4 libLLVM-3.9.so 0x00007fd07e025ada llvm::X86ATTInstPrinter::getRegisterName(unsigned int) + 10 5 libLLVM-3.9.so 0x00007fd07e025b60 llvm::X86ATTInstPrinter::printRegName(llvm::raw_ostream&, unsigned int) const + 48 6 libLLVM-3.9.so 0x00007fd07e026ba3 llvm::X86ATTInstPrinter::printOperand(llvm::MCInst const*, unsigned int, llvm::raw_ostream&) + 771 7 libLLVM-3.9.so 0x00007fd07e0290d2 llvm::X86ATTInstPrinter::printInstruction(llvm::MCInst const*, llvm::raw_ostream&) + 5730 8 libLLVM-3.9.so 0x00007fd07e02a75e llvm::X86ATTInstPrinter::printInst(llvm::MCInst const*, llvm::raw_ostream&, llvm::StringRef, llvm::MCSubtargetInfo const&) + 302 9 libLLVM-3.9.so 0x00007fd07dd3c7c4 10 libLLVM-3.9.so 0x00007fd07dfd17d0 11 libLLVM-3.9.so 0x00007fd07dfd46f1 12 libLLVM-3.9.so 0x00007fd07d6750d0 llvm::AsmPrinter::EmitFunctionBody() + 992 13 libLLVM-3.9.so 0x00007fd07dec5bac 14 libLLVM-3.9.so 0x00007fd07d36ce51 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 129 15 libLLVM-3.9.so 0x00007fd07d216012 llvm::FPPassManager::runOnFunction(llvm::Function&) + 498 16 libLLVM-3.9.so 0x00007fd07d21639b llvm::FPPassManager::runOnModule(llvm::Module&) + 43 17 libLLVM-3.9.so 0x00007fd07d2166c7 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 775 18 libclangCodeGen.so 0x00007fd07c1e1083 clang::EmitBackendOutput(clang::DiagnosticsEngine&, 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> >) + 6787 19 libclangCodeGen.so 0x00007fd07c37489b 20 libclangFrontend.so 0x00007fd07bbcb15e clang::FrontendAction::Execute() + 286 21 libclangFrontend.so 0x00007fd07bb94cd6 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 278 22 libclangFrontendTool.so 0x00007fd07b9272c3 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2227 23 clang-3.9 0x0000003c7bfc5c30 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 2336 24 clang-3.9 0x0000003c7bfc2705 main + 6997 25 libc.so.6 0x00007fd07a26a401 __libc_start_main + 241 26 clang-3.9 0x0000003c7bfc3fea _start + 42 Stack dump: 0. Program arguments: /usr/bin/clang-3.9 -cc1 -triple x86_64-unknown-linux-gnu -S -disable-free -disable-llvm-verifier -discard-value-names -main-file-name integer.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu skylake -target-feature +sse2 -target-feature +cx16 -target-feature -tbm -target-feature -avx512ifma -target-feature -avx512dq -target-feature -fma4 -target-feature +prfchw -target-feature +bmi2 -target-feature +xsavec -target-feature +fsgsbase -target-feature +popcnt -target-feature +aes -target-feature -pcommit -target-feature +xsaves -target-feature -avx512er -target-feature -clwb -target-feature -avx512f -target-feature -pku -target-feature +smap -target-feature +mmx -target-feature -xop -target-feature +rdseed -target-feature -hle -target-feature -sse4a -target-feature -avx512bw -target-feature +clflushopt -target-feature +xsave -target-feature -avx512vl -target-feature +invpcid -target-feature -avx512cd -target-feature +avx -target-feature -rtm -target-feature +fma -target-feature +bmi -target-feature -mwaitx -target-feature +rdrnd -target-feature +sse4.1 -target-feature +sse4.2 -target-feature +avx2 -target-feature +sse -target-feature +lzcnt -target-feature +pclmul -target-feature -prefetchwt1 -target-feature +f16c -target-feature +ssse3 -target-feature +sgx -target-feature +cmov -target-feature -avx512vbmi -target-feature +movbe -target-feature +xsaveopt -target-feature -sha -target-feature +adx -target-feature -avx512pf -target-feature +sse3 -momit-leaf-frame-pointer -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -resource-dir /usr/bin/../lib64/clang/3.9.1 -O3 -fdebug-compilation-dir /home/jwalton/cryptopp-fork -ferror-limit 19 -fmessage-length 80 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o integer.s -x ir integer.bc 1. Code generation 2. Running pass 'Function Pass Manager' on module 'integer.bc'. 3. Running pass 'X86 Assembly / Object Emitter' on function '@_ZN8CryptoPP7ADX_AddEmPmPKmS2_' clang-3.9: error: unable to execute command: Segmentation fault (core dumped) clang-3.9: error: clang frontend command failed due to signal (use -v to see invocation) clang version 3.9.1 (tags/RELEASE_391/final) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /bin clang-3.9: note: diagnostic msg: PLEASE submit a bug report to and include the crash backtrace, preprocessed source, and associated run script. clang-3.9: note: diagnostic msg: ******************** PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: Preprocessed source(s) and associated run script(s) are located at: clang-3.9: note: diagnostic msg: /tmp/integer-05cbef.cpp clang-3.9: note: diagnostic msg: /tmp/integer-05cbef.sh clang-3.9: note: diagnostic msg: ******************** skylake:cryptopp-fork$ [tag] [reply] [−] Comment 1 Jeffrey Walton 2017-08-20 17:55:24 PDT This should have been included in the report. Sorry about that. skylake:cryptopp-fork$ clang++ --version clang version 3.9.1 (tags/RELEASE_391/final) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /bin skylake:cryptopp-fork$ lsb_release -a LSB Version: :core-4.1-amd64:core-4.1-noarch Distributor ID: Fedora Description: Fedora release 25 (Twenty Five) Release: 25 Codename: TwentyFive k$ dnf info clang Last metadata expiration check: 0:00:31 ago on Sun Aug 20 20:55:16 2017. Installed Packages Name : clang Arch : x86_64 Epoch : 0 Version : 3.9.1 Release : 2.fc25 Size : 5.9 M Repo : @System From repo : updates Summary : A C language family front-end for LLVM URL : http://llvm.org License : NCSA Description : clang: noun : 1. A loud, resonant, metallic sound. : 2. The strident call of a crane or goose. : 3. C-language family front-end toolkit. : : The goal of the Clang project is to create a new C, C++, Objective : C and Objective C++ front-end for the LLVM compiler. Its tools are : built as libraries and designed to be loosely-coupled and : extensible.
I just installed Fedora 26 with Clang 4.0. It experiences the same crash. **************************************** $ dnf info clang Last metadata expiration check: 0:00:05 ago on Mon 21 Aug 2017 04:13:09 AM EDT. Installed Packages Name : clang Version : 4.0.0 Release : 3.fc26 Arch : x86_64 Size : 6.4 M Source : clang-4.0.0-3.fc26.src.rpm Repo : @System From repo : @commandline Summary : A C language family front-end for LLVM URL : http://llvm.org License : NCSA Description : clang: noun : 1. A loud, resonant, metallic sound. : 2. The strident call of a crane or goose. : 3. C-language family front-end toolkit. : : The goal of the Clang project is to create a new C, C++, : Objective C and Objective C++ front-end for the LLVM compiler. : Its tools are built as libraries and designed to be : loosely-coupled and extensible.
Can you provide the information requested in the upstream bug? https://bugs.llvm.org/show_bug.cgi?id=34249
This message is a reminder that Fedora 26 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 26. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '26'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 26 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete.
Fedora 26 changed to end-of-life (EOL) status on 2018-05-29. Fedora 26 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. If you are unable to reopen this bug, please file a new report against the current release. If you experience problems, please add a comment to this bug. Thank you for reporting this bug and we are sorry it could not be fixed.