[llvm-bugs] [Bug 28781] New: Dwarf-related crash with clang & llvm-link

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jul 30 11:10:48 PDT 2016


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

            Bug ID: 28781
           Summary: Dwarf-related crash with clang & llvm-link
           Product: new-bugs
           Version: 3.9
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: robin at icir.org
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 16844
  --> https://llvm.org/bugs/attachment.cgi?id=16844&action=edit
Source code

Compiling & linking the attached code as follows:

   # clang -emit-llvm -g  -O2 -o a.o  -c a.c && llvm-link -o a.bc a.o && clang
a.bc

results in the output below. If I remove either -O2 or -g, the crash goes away.
I also couldn't get the C code any smaller, if I remove more code, the problem
disappears. Interestingly, it also goes aways if I just run clang-format on the
file to break up the one long line in there (this came out of the
preprocessor). 

This is with LLVM/clang 3.9 as of commit 4105790f1549.


#0 0x00000000018edb65 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/opt/llvm39-RelWithDebugInfo/src/llvm/build/../lib/Support/Unix/Signals.inc:406:0
#1 0x00000000018ebd8e llvm::sys::RunSignalHandlers()
/opt/llvm39-RelWithDebugInfo/src/llvm/build/../lib/Support/Signals.cpp:45:0
#2 0x00000000018ebec8 SignalHandler(int)
/opt/llvm39-RelWithDebugInfo/src/llvm/build/../lib/Support/Unix/Signals.inc:246:0
#3 0x00007f5d9ca13a00 __restore_rt (/lib64/libpthread.so.0+0x10a00)
#4 0x0000000001db7373 llvm::DwarfUnit::addDIEEntry(llvm::DIE&,
llvm::dwarf::Attribute, llvm::DIEEntry)
/opt/llvm39-RelWithDebugInfo/src/llvm/build/../lib/CodeGen/AsmPrinter/DwarfUnit.cpp:294:0
#5 0x0000000001db73cc llvm::DwarfUnit::addDIEEntry(llvm::DIE&,
llvm::dwarf::Attribute, llvm::DIE&)
/opt/llvm39-RelWithDebugInfo/src/llvm/build/../lib/CodeGen/AsmPrinter/DwarfUnit.cpp:267:0
#6 0x0000000001da8939 llvm::DwarfDebug::finishVariableDefinitions()
/opt/llvm39-RelWithDebugInfo/src/llvm/build/../lib/CodeGen/AsmPrinter/DwarfDebug.cpp:506:0
#7 0x0000000001da8a37 __gnu_cxx::__normal_iterator<std::pair<llvm::MDNode
const*, llvm::DwarfCompileUnit*>*, std::vector<std::pair<llvm::MDNode const*,
llvm::DwarfCompileUnit*>, std::allocator<std::pair<llvm::MDNode const*,
llvm::DwarfCompileUnit*> > > >::__normal_iterator(std::pair<llvm::MDNode
const*, llvm::DwarfCompileUnit*>* const&)
/usr/include/c++/5.3.1/bits/stl_iterator.h:741:0
#8 0x0000000001da8a37 std::vector<std::pair<llvm::MDNode const*,
llvm::DwarfCompileUnit*>, std::allocator<std::pair<llvm::MDNode const*,
llvm::DwarfCompileUnit*> > >::end()
/usr/include/c++/5.3.1/bits/stl_vector.h:566:0
#9 0x0000000001da8a37 llvm::MapVector<llvm::MDNode const*,
llvm::DwarfCompileUnit*, llvm::DenseMap<llvm::MDNode const*, unsigned int,
llvm::DenseMapInfo<llvm::MDNode const*>,
llvm::detail::DenseMapPair<llvm::MDNode const*, unsigned int> >,
std::vector<std::pair<llvm::MDNode const*, llvm::DwarfCompileUnit*>,
std::allocator<std::pair<llvm::MDNode const*, llvm::DwarfCompileUnit*> > >
>::end()
/opt/llvm39-RelWithDebugInfo/src/llvm/build/../include/llvm/ADT/MapVector.h:48:0
#10 0x0000000001da8a37 llvm::DwarfDebug::finalizeModuleInfo()
/opt/llvm39-RelWithDebugInfo/src/llvm/build/../lib/CodeGen/AsmPrinter/DwarfDebug.cpp:543:0
#11 0x0000000001db1410 llvm::DwarfDebug::endModule()
/opt/llvm39-RelWithDebugInfo/src/llvm/build/../lib/CodeGen/AsmPrinter/DwarfDebug.cpp:622:0
#12 0x0000000001d9ccee llvm::AsmPrinter::doFinalization(llvm::Module&)
/opt/llvm39-RelWithDebugInfo/src/llvm/build/../lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1170:0
#13 0x0000000001567389 llvm::FPPassManager::doFinalization(llvm::Module&)
/opt/llvm39-RelWithDebugInfo/src/llvm/build/../lib/IR/LegacyPassManager.cpp:1565:0
#14 0x0000000001572535 runOnModule
/opt/llvm39-RelWithDebugInfo/src/llvm/build/../lib/IR/LegacyPassManager.cpp:1621:0
#15 0x0000000001572535 llvm::legacy::PassManagerImpl::run(llvm::Module&)
/opt/llvm39-RelWithDebugInfo/src/llvm/build/../lib/IR/LegacyPassManager.cpp:1706:0
#16 0x0000000001a3593f llvm::PrettyStackTraceString::~PrettyStackTraceString()
/opt/llvm39-RelWithDebugInfo/src/llvm/build/../include/llvm/Support/PrettyStackTrace.h:51:0
#17 0x0000000001a3593f EmitAssembly
/opt/llvm39-RelWithDebugInfo/src/llvm/build/../tools/clang/lib/CodeGen/BackendUtil.cpp:738:0
#18 0x0000000001a3593f 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> >)
/opt/llvm39-RelWithDebugInfo/src/llvm/build/../tools/clang/lib/CodeGen/BackendUtil.cpp:751:0
#19 0x0000000001f90040 std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >::~unique_ptr()
/usr/include/c++/5.3.1/bits/unique_ptr.h:235:0
#20 0x0000000001f90040 clang::CodeGenAction::ExecuteAction() [clone .part.99]
[clone .constprop.100]
/opt/llvm39-RelWithDebugInfo/src/llvm/build/../tools/clang/lib/CodeGen/CodeGenAction.cpp:846:0
#21 0x0000000001d07ab6 clang::FrontendAction::Execute()
/opt/llvm39-RelWithDebugInfo/src/llvm/build/../tools/clang/lib/Frontend/FrontendAction.cpp:457:0
#22 0x0000000001cdbb66
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/opt/llvm39-RelWithDebugInfo/src/llvm/build/../tools/clang/lib/Frontend/CompilerInstance.cpp:868:0
#23 0x0000000001d800f2
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/opt/llvm39-RelWithDebugInfo/src/llvm/build/../tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:241:0
#24 0x0000000000914fe0 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
/opt/llvm39-RelWithDebugInfo/src/llvm/build/../tools/clang/tools/driver/cc1_main.cpp:116:0
#25 0x00000000008b333d ExecuteCC1Tool
/opt/llvm39-RelWithDebugInfo/src/llvm/build/../tools/clang/tools/driver/driver.cpp:301:0
#26 0x00000000008b333d main
/opt/llvm39-RelWithDebugInfo/src/llvm/build/../tools/clang/tools/driver/driver.cpp:382:0
#27 0x00007f5d9b57b580 __libc_start_main (/lib64/libc.so.6+0x20580)
#28 0x0000000000913479 _start (/xa/opt/llvm39-Release/bin/clang-3.9+0x913479)
Stack dump:
0.    Program arguments: /xa/opt/llvm39-Release/bin/clang-3.9 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -discard-value-names -main-file-name a.bc
-mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array
-target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -resource-dir
/xa/opt/llvm39-Release/bin/../lib/clang/3.9.0 -fdebug-compilation-dir
/home/robin/work/hilti-test/build -ferror-limit 19 -fmessage-length 0
-fobjc-runtime=gcc -fdiagnostics-show-option -o /tmp/a-ec353d.o -x ir a.bc 
1.    Code generation
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.0 (http://llvm.org/git/clang.git
5fab0a9b5ae56b84d01af79e79ab8e58bf433b82) (http://llvm.org/git/llvm.git
4105790f1549808c1f1daa5250b4ada5f41a5c02)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/llvm39/bin
clang-3.9: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang-3.9: note: diagnostic msg: Error generating preprocessed source(s) - no
preprocessable inputs.

-- 
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/20160730/9e3dae8c/attachment.html>


More information about the llvm-bugs mailing list