[llvm-bugs] [Bug 28747] New: [CodeView] Assertion `cast<DISubprogram>(Scope)->describes(MF->getFunction())' failed

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jul 27 18:58:00 PDT 2016


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

            Bug ID: 28747
           Summary: [CodeView] Assertion
                    `cast<DISubprogram>(Scope)->describes(MF->getFunction(
                    ))' failed
           Product: new-bugs
           Version: 3.9
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: edy.burt at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Inlined scopes are not entirely handled by LexicalScopes which CodeView uses.
This can be reproduced without optimizations by using always-inline functions:

// clang -g -gcodeview -target x86_64-pc-windows-msvc test.c
// test.c:
__attribute__((always_inline)) static void foo() { int x = 5; }
__attribute__((always_inline)) static void bar() { foo(); }
__attribute__((nodebug)) void baz() { bar(); }

The visible effect is a failed assertion (same on 3.9 and trunk):

/home/eddy/Projects/rust/src/llvm/lib/CodeGen/LexicalScopes.cpp:159:
llvm::LexicalScope* llvm::LexicalScopes::getOrCreateRegularScope(const
llvm::DILocalScope*): Assertion
`cast<DISubprogram>(Scope)->describes(MF->getFunction())' failed.
#0 0x0000000002af486b llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/eddy/Projects/rust/src/llvm/lib/Support/Unix/Signals.inc:402:0
#1 0x0000000002af4c2f PrintStackTraceSignalHandler(void*)
/home/eddy/Projects/rust/src/llvm/lib/Support/Unix/Signals.inc:470:0
#2 0x0000000002af2e77 llvm::sys::RunSignalHandlers()
/home/eddy/Projects/rust/src/llvm/lib/Support/Signals.cpp:44:0
#3 0x0000000002af4106 SignalHandler(int)
/home/eddy/Projects/rust/src/llvm/lib/Support/Unix/Signals.inc:256:0
#4 0x00007fa3a655ae70 __restore_rt
(/nix/store/yg7g05x78xpc1zgsivsr9x51a40vxwiy-glibc-multi-2.23/lib/libpthread.so.0+0x10e70)
#5 0x00007fa3a553b3e8 __GI_raise
(/nix/store/yg7g05x78xpc1zgsivsr9x51a40vxwiy-glibc-multi-2.23/lib/libc.so.6+0x333e8)
#6 0x00007fa3a553c86a __GI_abort
(/nix/store/yg7g05x78xpc1zgsivsr9x51a40vxwiy-glibc-multi-2.23/lib/libc.so.6+0x3486a)
#7 0x00007fa3a5534387 __assert_fail_base
(/nix/store/yg7g05x78xpc1zgsivsr9x51a40vxwiy-glibc-multi-2.23/lib/libc.so.6+0x2c387)
#8 0x00007fa3a5534432
(/nix/store/yg7g05x78xpc1zgsivsr9x51a40vxwiy-glibc-multi-2.23/lib/libc.so.6+0x2c432)
#9 0x00000000024ad279
llvm::LexicalScopes::getOrCreateRegularScope(llvm::DILocalScope const*)
/home/eddy/Projects/rust/src/llvm/lib/CodeGen/LexicalScopes.cpp:160:0
#10 0x00000000024ad088
llvm::LexicalScopes::getOrCreateLexicalScope(llvm::DILocalScope const*,
llvm::DILocation const*)
/home/eddy/Projects/rust/src/llvm/lib/CodeGen/LexicalScopes.cpp:137:0
#11 0x00000000024aca54
llvm::LexicalScopes::getOrCreateLexicalScope(llvm::DILocation const*)
/home/eddy/Projects/rust/src/llvm/include/llvm/CodeGen/LexicalScopes.h:209:0
#12 0x00000000024ad434
llvm::LexicalScopes::getOrCreateInlinedScope(llvm::DILocalScope const*,
llvm::DILocation const*)
/home/eddy/Projects/rust/src/llvm/lib/CodeGen/LexicalScopes.cpp:182:0
#13 0x00000000024ad073
llvm::LexicalScopes::getOrCreateLexicalScope(llvm::DILocalScope const*,
llvm::DILocation const*)
/home/eddy/Projects/rust/src/llvm/lib/CodeGen/LexicalScopes.cpp:133:0
#14 0x00000000024aca54
llvm::LexicalScopes::getOrCreateLexicalScope(llvm::DILocation const*)
/home/eddy/Projects/rust/src/llvm/include/llvm/CodeGen/LexicalScopes.h:209:0
#15 0x00000000024acdfd
llvm::LexicalScopes::extractLexicalScopes(llvm::SmallVectorImpl<std::pair<llvm::MachineInstr
const*, llvm::MachineInstr const*> >&, llvm::DenseMap<llvm::MachineInstr
const*, llvm::LexicalScope*, llvm::DenseMapInfo<llvm::MachineInstr const*>,
llvm::detail::DenseMapPair<llvm::MachineInstr const*, llvm::LexicalScope*> >&)
/home/eddy/Projects/rust/src/llvm/lib/CodeGen/LexicalScopes.cpp:102:0
#16 0x00000000024acb3e llvm::LexicalScopes::initialize(llvm::MachineFunction
const&) /home/eddy/Projects/rust/src/llvm/lib/CodeGen/LexicalScopes.cpp:46:0
#17 0x0000000003447739
llvm::DebugHandlerBase::beginFunction(llvm::MachineFunction const*)
/home/eddy/Projects/rust/src/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp:121:0
#18 0x00000000034235f9 llvm::CodeViewDebug::beginFunction(llvm::MachineFunction
const*)
/home/eddy/Projects/rust/src/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:875:0
#19 0x00000000033b8403 llvm::AsmPrinter::EmitFunctionHeader()
/home/eddy/Projects/rust/src/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:601:0
#20 0x00000000033b976e llvm::AsmPrinter::EmitFunctionBody()
/home/eddy/Projects/rust/src/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:845:0
#21 0x00000000016adba5
llvm::X86AsmPrinter::runOnMachineFunction(llvm::MachineFunction&)
/home/eddy/Projects/rust/src/llvm/lib/Target/X86/X86AsmPrinter.cpp:73:0
#22 0x000000000224bda8
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
/home/eddy/Projects/rust/src/llvm/lib/CodeGen/MachineFunctionPass.cpp:60:0
#23 0x00000000025d5a51 llvm::FPPassManager::runOnFunction(llvm::Function&)
/home/eddy/Projects/rust/src/llvm/lib/IR/LegacyPassManager.cpp:1526:0
#24 0x00000000025d5bc8 llvm::FPPassManager::runOnModule(llvm::Module&)
/home/eddy/Projects/rust/src/llvm/lib/IR/LegacyPassManager.cpp:1547:0
#25 0x00000000025d5f15 (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&)
/home/eddy/Projects/rust/src/llvm/lib/IR/LegacyPassManager.cpp:1603:0
#26 0x00000000025d65e3 llvm::legacy::PassManagerImpl::run(llvm::Module&)
/home/eddy/Projects/rust/src/llvm/lib/IR/LegacyPassManager.cpp:1706:0
#27 0x00000000025d67ef llvm::legacy::PassManager::run(llvm::Module&)
/home/eddy/Projects/rust/src/llvm/lib/IR/LegacyPassManager.cpp:1738:0
#28 0x0000000002d44c0d (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
/home/eddy/Projects/rust/src/llvm/tools/clang/lib/CodeGen/BackendUtil.cpp:740:0
#29 0x0000000002d44d67 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> >)
/home/eddy/Projects/rust/src/llvm/tools/clang/lib/CodeGen/BackendUtil.cpp:753:0
#30 0x000000000369c84c
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
/home/eddy/Projects/rust/src/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:195:0
#31 0x00000000041172bd clang::ParseAST(clang::Sema&, bool, bool)
/home/eddy/Projects/rust/src/llvm/tools/clang/lib/Parse/ParseAST.cpp:169:0
#32 0x000000000327a18b clang::ASTFrontendAction::ExecuteAction()
/home/eddy/Projects/rust/src/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:558:0
#33 0x000000000369f817 clang::CodeGenAction::ExecuteAction()
/home/eddy/Projects/rust/src/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:868:0
#34 0x0000000003279c21 clang::FrontendAction::Execute()
/home/eddy/Projects/rust/src/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:462:0
#35 0x000000000322c090
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/home/eddy/Projects/rust/src/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp:869:0
#36 0x000000000339877b
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/home/eddy/Projects/rust/src/llvm/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:241:0
#37 0x000000000169d62d cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
/home/eddy/Projects/rust/src/llvm/tools/clang/tools/driver/cc1_main.cpp:116:0
#38 0x0000000001694142 ExecuteCC1Tool(llvm::ArrayRef<char const*>,
llvm::StringRef)
/home/eddy/Projects/rust/src/llvm/tools/clang/tools/driver/driver.cpp:299:0
#39 0x0000000001694d1e main
/home/eddy/Projects/rust/src/llvm/tools/clang/tools/driver/driver.cpp:380:0
#40 0x00007fa3a5528770 __libc_start_main
(/nix/store/yg7g05x78xpc1zgsivsr9x51a40vxwiy-glibc-multi-2.23/lib/libc.so.6+0x20770)
#41 0x0000000001690459 _start
/tmp/nix-build-glibc-2.23.drv-0/glibc-2.23/csu/../sysdeps/x86_64/start.S:121:0

-- 
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/20160728/329eac8a/attachment-0001.html>


More information about the llvm-bugs mailing list