llvm / llvm/llvm-project

Crash "cannot apply another specifier to MCSpecifierExpr" on aarch64-apple assembly

Open
#170,640 2 comments 0 reactions 0 assignees View on GitHub
backend:AArch64 confirmed crash-on-invalid crash-on-valid llvm:mc platform:macos regression:18
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Input, slightly invalid asm syntax (elf syntax on apple):

```llvm
module asm "add w16, [x16, :lo12:_DEMO@PAGE]"
```

Output, with `-mtriple=aarch64-apple-darwin`

```text
cannot apply another specifier to MCSpecifierExpr
UNREACHABLE executed at /root/llvm-project/llvm/lib/MC/MCParser/AsmParser.cpp:1330!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel -mtriple=aarch64-apple-darwin
#0 0x0000000004205548 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x4205548)
#1 0x00000000042023f4 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#2 0x00007f251fc42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x00007f251fc969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#4 0x00007f251fc42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#5 0x00007f251fc287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#6 0x000000000414b9ea (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x414b9ea)
#7 0x00000000054e120a llvm::MCAsmParser::applySpecifier(llvm::MCExpr const*, unsigned int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x54e120a)
#8 0x00000000054e13ff llvm::MCAsmParser::parseAtSpecifier(llvm::MCExpr const*&, llvm::SMLoc&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x54e13ff)
#9 0x000000000090e615 (anonymous namespace)::AArch64AsmParser::parseSymbolicImmVal(llvm::MCExpr const*&) AArch64AsmParser.cpp:0:0
#10 0x0000000000943ad3 (anonymous namespace)::AArch64AsmParser::parseOperand(llvm::SmallVectorImpl>>&, bool, bool) AArch64AsmParser.cpp:0:0
#11 0x0000000000946b8a (anonymous namespace)::AArch64AsmParser::parseInstruction(llvm::ParseInstructionInfo&, llvm::StringRef, llvm::SMLoc, llvm::SmallVectorImpl>>&) AArch64AsmParser.cpp:0:0
#12 0x00000000054e48c2 (anonymous namespace)::AsmParser::parseAndMatchAndEmitTargetInstruction((anonymous namespace)::ParseStatementInfo&, llvm::StringRef, llvm::AsmToken, llvm::SMLoc) AsmParser.cpp:0:0
#13 0x00000000054f8fd3 (anonymous namespace)::AsmParser::parseStatement((anonymous namespace)::ParseStatementInfo&, llvm::MCAsmParserSemaCallback*) (.part.0) AsmParser.cpp:0:0
#14 0x00000000054fcd63 (anonymous namespace)::AsmParser::Run(bool, bool) AsmParser.cpp:0:0
#15 0x0000000002df89d6 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/llc+0x2df89d6)
#16 0x0000000002de8099 llvm::AsmPrinter::doInitialization(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2de8099)
#17 0x00000000037357b9 llvm::FPPassManager::doInitialization(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x37357b9)
#18 0x00000000037401fc llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x37401fc)
#19 0x00000000008fccd4 compileModule(char**, llvm::LLVMContext&, std::__cxx11::basic_string, std::allocator>&) llc.cpp:0:0
#20 0x00000000007c6ef9 main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x7c6ef9)
#21 0x00007f251fc29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#22 0x00007f251fc29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#23 0x00000000008f1ed5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x8f1ed5)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```

https://llvm.godbolt.org/z/dco38qrbG

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.