dvm-system / sapfor

SAPFOR (System FOR Automated Parallelization)
Apache License 2.0
6 stars 5 forks source link

.ll file by clang crashes tsar #3

Open mishapankin opened 1 year ago

mishapankin commented 1 year ago

Проблема

Если попытаться анализировать файл, полученный с помощью clang, а не tsar, то tsar падает.

Воспроизведение

  1. Создать файл bug.c
    int main() { return 0; }
  2. Скомпилировать файл с помощью clang
    clang bug.c -emit-llvm -S
  3. Запустить анализ
    tsar bug.ll --print-all

Ошибка

Segmentation fault

 #0 0x000055cbfa02e3b1 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/mishapankin/Work/sapfor/build/analyzers/tsar/bin/tsar+0x23cc3b1)
 #1 0x000055cbfa02c0cc llvm::sys::RunSignalHandlers() (/home/mishapankin/Work/sapfor/build/analyzers/tsar/bin/tsar+0x23ca0cc)
 #2 0x000055cbfa02e8db SignalHandler(int) Signals.cpp.o:0:0
 #3 0x00007fee0fc42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x000055cbf9ea34a0 llvm::NamedMDNode::getNumOperands() const (/home/mishapankin/Work/sapfor/build/analyzers/tsar/bin/tsar+0x22414a0)
 #5 0x000055cbf894b6cf llvm::NamedMDNode::op_end() /usr/lib/llvm-15/include/llvm/IR/Metadata.h:1677:35
 #6 0x000055cbf894b736 llvm::NamedMDNode::operands() /usr/lib/llvm-15/include/llvm/IR/Metadata.h:1685:22
 #7 0x000055cbf8946c17 tsar::executeIRAction(llvm::StringRef, llvm::ArrayRef<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, tsar::QueryManager&, clang::tooling::CompilationDatabase const*) /home/mishapankin/Work/sapfor/analyzers/tsar/lib/Core/IRAction.cpp:260:37
 #8 0x000055cbf8918722 tsar::Tool::run(tsar::QueryManager*) /home/mishapankin/Work/sapfor/analyzers/tsar/lib/Core/Tool.cpp:854:29
 #9 0x000055cbf890f4a6 main /home/mishapankin/Work/sapfor/analyzers/tsar/tools/tsar/main.cpp:42:22
#10 0x00007fee0fc29d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#11 0x00007fee0fc29e40 call_init ./csu/../csu/libc-start.c:128:20
#12 0x00007fee0fc29e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#13 0x000055cbf890f325 _start (/home/mishapankin/Work/sapfor/build/analyzers/tsar/bin/tsar+0xcad325)
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.  Program arguments: /home/mishapankin/Work/sapfor/build/analyzers/tsar/bin/tsar bug.ll --print-all