Issue 173195
Summary [clang] Assertion failure in MCContext::getOrCreateSymbol on empty symbol name from inline assembly
Labels backend:X86, crash-on-invalid
Assignees
Reporter AbyssStaror
    ### Link for quick verification: https://godbolt.org/z/89M7Tzr68
```c
__asm__(
".pushsection .debug_info, \"MS\",@progbits\n"
"Ldbg_marker:\n"
"\"\":\n"
"\t.byte\t3\n"
"\t.int\tLdbg_marker\n"
".popsection");
```
Go back to `clang 3.5.0 (assertions)`
This seems to be a legitimate compiler bug in the debug information processing subsystem, while the triggering code is unusual.

## Stack dump:
```
clang++: /root/llvm-project/llvm/lib/MC/MCContext.cpp:207: llvm::MCSymbol* llvm::MCContext::getOrCreateSymbol(const llvm::Twine&): Assertion `!NameRef.empty() && "Normal symbols cannot be unnamed!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics <source>
1.	<eof> parser at end of file
2.	Code generation
 #0 0x00000000042a6d18 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x42a6d18)
 #1 0x00000000042a4144 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x42a4144)
 #2 0x00000000041e9638 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x000079ea7ee42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x000079ea7ee969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x000079ea7ee42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x000079ea7ee287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x000079ea7ee2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x000079ea7ee39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x0000000003f431f4 (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3f431f4)
#10 0x0000000003f43d79 llvm::MCContext::parseSymbol(llvm::Twine const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3f43d79)
#11 0x0000000004007fc5 (anonymous namespace)::AsmParser::parseStatement((anonymous namespace)::ParseStatementInfo&, llvm::MCAsmParserSemaCallback*) (.part.0) AsmParser.cpp:0:0
#12 0x000000000400b723 (anonymous namespace)::AsmParser::Run(bool, bool) AsmParser.cpp:0:0
#13 0x0000000005209c9d llvm::AsmPrinter::emitInlineAsm(llvm::StringRef, llvm::MCSubtargetInfo const&, llvm::MCTargetOptions const&, llvm::MDNode const*, llvm::InlineAsm::AsmDialect) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5209c9d)
#14 0x00000000051f9107 llvm::AsmPrinter::doInitialization(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x51f9107)
#15 0x0000000003b93399 llvm::FPPassManager::doInitialization(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3b93399)
#16 0x0000000003b9dddc llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3b9dddc)
#17 0x00000000045672fd clang::emitBackendOutput(clang::CompilerInstance&, clang::CodeGenOptions&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x45672fd)
#18 0x0000000004bfe667 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4bfe667)
#19 0x000000000698b4cc clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x698b4cc)
#20 0x0000000004bfeac8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4bfeac8)
#21 0x0000000004ef3475 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4ef3475)
#22 0x0000000004e7372e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4e7372e)
#23 0x0000000004fed63d clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4fed63d)
#24 0x0000000000ddabbc cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xddabbc)
#25 0x0000000000dd160a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>) driver.cpp:0:0
#26 0x0000000000dd178d int llvm::function_ref<int (llvm::SmallVectorImpl<char const*>&)>::callback_fn<clang_main(int, char**, llvm::ToolContext const&)::'lambda'(llvm::SmallVectorImpl<char const*>&)>(long, llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#27 0x0000000004c70759 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#28 0x00000000041e9ad4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x41e9ad4)
#29 0x0000000004c70d6f clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#30 0x0000000004c32452 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4c32452)
#31 0x0000000004c333fe clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4c333fe)
#32 0x0000000004c3a6d5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4c3a6d5)
#33 0x0000000000dd6fb1 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xdd6fb1)
#34 0x0000000000c82094 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc82094)
#35 0x000079ea7ee29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#36 0x000079ea7ee29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#37 0x0000000000dd10a5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xdd10a5)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to