[llvm-bugs] [Bug 34249] New: Panic when using _addcarryx_u64 with Clang 3.9

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Aug 20 17:51:50 PDT 2017


            Bug ID: 34249
           Summary: Panic when using _addcarryx_u64 with Clang 3.9
           Product: clang
           Version: 3.9
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: noloader at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 19014
  --> https://bugs.llvm.org/attachment.cgi?id=19014&action=edit
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

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.


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() +
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 +
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::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
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
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:

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:


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/20170821/d0d343b5/attachment.html>

More information about the llvm-bugs mailing list