Skip to content

"cf-protection-branch" module flag plus module asm ".pushsection .note.gnu.property" causes assertion failure in CodeGen backend #65530

Closed
@nmosier

Description

@nmosier

Attached is the LLVM IR bitcode (minimized with bugpoint) that triggers the following assertion failure.
To reproduce, execute the command llc bugpoint-reduced-simplified.bc, which should crash with something like this:

llc: /home/nmosier/.tmp/llvm/llvm/lib/MC/MCStreamer.cpp:1254: virtual void llvm::MCStreamer::switchSection(llvm::MCSection*, const llvm::MCExpr*): Assertion `!Section->hasEnded() && "Section already ended"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /home/nmosier/.tmp/llvm/build-debug/bin/llc bugpoint-reduced-simplified.bc
 #0 0x00005564b579fb24 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/nmosier/.tmp/llvm/llvm/lib/Support/Unix/Signals.inc:723:22
 #1 0x00005564b579ff40 PrintStackTraceSignalHandler(void*) /home/nmosier/.tmp/llvm/llvm/lib/Support/Unix/Signals.inc:798:1
 #2 0x00005564b579d38d llvm::sys::RunSignalHandlers() /home/nmosier/.tmp/llvm/llvm/lib/Support/Signals.cpp:105:20
 #3 0x00005564b579f3bc SignalHandler(int) /home/nmosier/.tmp/llvm/llvm/lib/Support/Unix/Signals.inc:413:1
 #4 0x00007f67aba0c520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #5 0x00007f67aba60a7c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #6 0x00007f67aba60a7c __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #7 0x00007f67aba60a7c pthread_kill ./nptl/pthread_kill.c:89:10
 #8 0x00007f67aba0c476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #9 0x00007f67ab9f27f3 abort ./stdlib/abort.c:81:7
#10 0x00007f67ab9f271b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#11 0x00007f67aba03e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#12 0x00005564b4fcacde llvm::MCStreamer::switchSection(llvm::MCSection*, llvm::MCExpr const*) /home/nmosier/.tmp/llvm/llvm/lib/MC/MCStreamer.cpp:1255:44
#13 0x00005564b60d5f4c (anonymous namespace)::ELFAsmParser::ParseSectionArguments(bool, llvm::SMLoc) /home/nmosier/.tmp/llvm/llvm/lib/MC/MCParser/ELFAsmParser.cpp:702:22
#14 0x00005564b60d4000 (anonymous namespace)::ELFAsmParser::ParseDirectivePushSection(llvm::StringRef, llvm::SMLoc) /home/nmosier/.tmp/llvm/llvm/lib/MC/MCParser/ELFAsmParser.cpp:398:3
#15 0x00005564b60d8b82 bool llvm::MCAsmParserExtension::HandleDirective<(anonymous namespace)::ELFAsmParser, &(anonymous namespace)::ELFAsmParser::ParseDirectivePushSection(llvm::StringRef, llvm::SMLoc)>(llvm::MCAsmParserExtension*, llvm::StringRef, llvm::SMLoc) /home/nmosier/.tmp/llvm/llvm/include/llvm/MC/MCParser/MCAsmParserExtension.h:37:3
#16 0x00005564b608e9f8 (anonymous namespace)::AsmParser::parseStatement((anonymous namespace)::ParseStatementInfo&, llvm::MCAsmParserSemaCallback*) /home/nmosier/.tmp/llvm/llvm/lib/MC/MCParser/AsmParser.cpp:2015:31
#17 0x00005564b6089da5 (anonymous namespace)::AsmParser::Run(bool, bool) /home/nmosier/.tmp/llvm/llvm/lib/MC/MCParser/AsmParser.cpp:1001:33
#18 0x00005564b415173f llvm::AsmPrinter::emitInlineAsm(llvm::StringRef, llvm::MCSubtargetInfo const&, llvm::MCTargetOptions const&, llvm::MDNode const*, llvm::InlineAsm::AsmDialect) const /home/nmosier/.tmp/llvm/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp:130:19
#19 0x00005564b4108358 llvm::AsmPrinter::doInitialization(llvm::Module&) /home/nmosier/.tmp/llvm/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:505:18
#20 0x00005564b37f6862 llvm::X86AsmPrinter::doInitialization(llvm::Module&) /home/nmosier/.tmp/llvm/llvm/lib/Target/X86/X86AsmPrinter.h:151:3
#21 0x00005564b4db2bca llvm::FPPassManager::doInitialization(llvm::Module&) /home/nmosier/.tmp/llvm/llvm/lib/IR/LegacyPassManager.cpp:1490:13
#22 0x00005564b4db2de0 (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) /home/nmosier/.tmp/llvm/llvm/lib/IR/LegacyPassManager.cpp:1524:13
#23 0x00005564b4dadc1e llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/nmosier/.tmp/llvm/llvm/lib/IR/LegacyPassManager.cpp:535:13
#24 0x00005564b4db388d llvm::legacy::PassManager::run(llvm::Module&) /home/nmosier/.tmp/llvm/llvm/lib/IR/LegacyPassManager.cpp:1678:1
#25 0x00005564b378c892 compileModule(char**, llvm::LLVMContext&) /home/nmosier/.tmp/llvm/llvm/tools/llc/llc.cpp:754:66
#26 0x00005564b378a18b main /home/nmosier/.tmp/llvm/llvm/tools/llc/llc.cpp:416:35
#27 0x00007f67ab9f3d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#28 0x00007f67ab9f3e40 call_init ./csu/../csu/libc-start.c:128:20
#29 0x00007f67ab9f3e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#30 564b3788de5 _start (/home/nmosier/.tmp/llvm/build-debug/bin/llc+0x57ade5)
Aborted

I verified that this bug impacts the main branch as well as the release-16.x branch.
bugpoint-reduced-simplified.bc.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    backend:X86crashPrefer [crash-on-valid] or [crash-on-invalid]

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions