-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Labels
backend:AVRcrashPrefer [crash-on-valid] or [crash-on-invalid]Prefer [crash-on-valid] or [crash-on-invalid]
Description
This code falls through to binary code emission, at which point it hits an llvm_unreachable
. This may save you from getting any further if you've enabled the right CMake variable.
It is probably bad code that should get rejected way earlier.
target datalayout = "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8"
target triple = "avr-unknown-unknown"
define void @main() addrspace(1) #0 {
call addrspace(0) void asm sideeffect alignstack "st ${0}, ${1}", "e,r,~{sreg},~{memory}"(ptr nonnull inttoptr (i16 37 to ptr), i8 0)
unreachable
}
attributes #0 = { "target-cpu"="atmega328p" }
And speaking of "should get rejected way earlier": It does IF you have debug assertions enabled!
Backtrace
llc: /root/build/lib/Target/AVR/AVRGenAsmWriter.inc:1424: static const char* llvm::AVRInstPrinter::getRegisterName(llvm::MCRegister, unsigned int): Assertion `*(AsmStrsptr+RegAsmOffsetptr[RegNo-1]) && "Invalid alt name index for register!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel <source>
1. Running pass 'Function Pass Manager' on module '<source>'.
2. Running pass 'AVR Assembly Printer' on function '@main'
#0 0x0000000003ba9ae8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3ba9ae8)
#1 0x0000000003ba749c SignalHandler(int) Signals.cpp:0:0
#2 0x0000780202242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x00007802022969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#4 0x0000780202242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#5 0x00007802022287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#6 0x000078020222871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#7 0x0000780202239e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#8 0x00000000023ddeda llvm::AVRInstPrinter::printOperand(llvm::MCInst const*, unsigned int, llvm::raw_ostream&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x23ddeda)
#9 0x00000000023debb3 llvm::AVRInstPrinter::printInst(llvm::MCInst const*, unsigned long, llvm::StringRef, llvm::MCSubtargetInfo const&, llvm::raw_ostream&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x23debb3)
#10 0x000000000323fd02 llvm::MCTargetStreamer::prettyPrintAsm(llvm::MCInstPrinter&, unsigned long, llvm::MCInst const&, llvm::MCSubtargetInfo const&, llvm::raw_ostream&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x323fd02)
#11 0x00000000032a8faa (anonymous namespace)::MCAsmStreamer::emitInstruction(llvm::MCInst const&, llvm::MCSubtargetInfo const&) MCAsmStreamer.cpp:0:0
#12 0x00000000009691c5 (anonymous namespace)::AVRAsmParser::matchAndEmitInstruction(llvm::SMLoc, unsigned int&, llvm::SmallVectorImpl<std::unique_ptr<llvm::MCParsedAsmOperand, std::default_delete<llvm::MCParsedAsmOperand>>>&, llvm::MCStreamer&, unsigned long&, bool) AVRAsmParser.cpp:0:0
#13 0x0000000004bd205a (anonymous namespace)::AsmParser::parseAndMatchAndEmitTargetInstruction((anonymous namespace)::ParseStatementInfo&, llvm::StringRef, llvm::AsmToken, llvm::SMLoc) AsmParser.cpp:0:0
#14 0x0000000004bea616 (anonymous namespace)::AsmParser::parseStatement((anonymous namespace)::ParseStatementInfo&, llvm::MCAsmParserSemaCallback*) (.part.0) AsmParser.cpp:0:0
#15 0x0000000004bdf553 (anonymous namespace)::AsmParser::Run(bool, bool) AsmParser.cpp:0:0
#16 0x0000000002872b2f 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+0x2872b2f)
#17 0x00000000028739d7 llvm::AsmPrinter::emitInlineAsm(llvm::MachineInstr const*) const (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x28739d7)
#18 0x000000000286cbe6 llvm::AsmPrinter::emitFunctionBody() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x286cbe6)
#19 0x00000000014923c5 llvm::AsmPrinter::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x14923c5)
#20 0x0000000002b263d9 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#21 0x00000000031213c0 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x31213c0)
#22 0x0000000003121771 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3121771)
#23 0x0000000003122027 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3122027)
#24 0x000000000086aefc compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#25 0x0000000000756ae6 main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x756ae6)
#26 0x0000780202229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#27 0x0000780202229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#28 0x0000000000861c0e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x861c0e)
Program terminated with signal: SIGSEGV
Compiler returned: 139
h/t @dianqk
Metadata
Metadata
Assignees
Labels
backend:AVRcrashPrefer [crash-on-valid] or [crash-on-invalid]Prefer [crash-on-valid] or [crash-on-invalid]