Closed
Description
int gl_a;
int fn()
{
return gl_a;
}
$ ./bin/clang --target=avr -S /tmp/test_add.c -o - -mmcu=avr1
.text
.set __tmp_reg__, 0
.set __zero_reg__, 1
.set __SREG__, 63
.set __SP_H__, 62
.set __SP_L__, 61
.file "test_add.c"
fatal error: error in backend: Cannot select: t4: i16,ch = load<(dereferenceable load (s16) from @gl_a, align 1)> t0, t10, undef:i16
t10: i16 = WRAPPER TargetGlobalAddress:i16<ptr @gl_a> 0
t9: i16 = TargetGlobalAddress<ptr @gl_a> 0
t3: i16 = undef
In function: fn
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: ./bin/clang --target=avr -S /tmp/test_add.c -o - -mmcu=avr1
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module '/tmp/test_add.c'.
4. Running pass 'AVR DAG->DAG Instruction Selection' on function '@fn'
#0 0x0000aaaabdaacbb4 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (./bin/clang+0x3715bb4)
#1 0x0000aaaabdaaa9b0 llvm::sys::RunSignalHandlers() (./bin/clang+0x37139b0)
#2 0x0000aaaabdaabf10 llvm::sys::CleanupOnSignal(unsigned long) (./bin/clang+0x3714f10)
#3 0x0000aaaabda1fd54 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) CrashRecoveryContext.cpp:0:0
#4 0x0000aaaabda1fce4 llvm::CrashRecoveryContext::HandleExit(int) (./bin/clang+0x3688ce4)
#5 0x0000aaaabdaa72f0 llvm::sys::Process::Exit(int, bool) (./bin/clang+0x37102f0)
#6 0x0000aaaabb5fee18 llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>::~IntrusiveRefCntPtr() (./bin/clang+0x1267e18)
#7 0x0000aaaabda28140 llvm::report_fatal_error(llvm::Twine const&, bool) (./bin/clang+0x3691140)
#8 0x0000aaaabe92cb20 llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) (./bin/clang+0x4595b20)
#9 0x0000aaaabe92bb88 llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (./bin/clang+0x4594b88)
#10 0x0000aaaabbfec7bc (anonymous namespace)::AVRDAGToDAGISel::Select(llvm::SDNode*) AVRISelDAGToDAG.cpp:0:0
#11 0x0000aaaabe9224bc llvm::SelectionDAGISel::DoInstructionSelection() (./bin/clang+0x458b4bc)
#12 0x0000aaaabe921570 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (./bin/clang+0x458a570)
#13 0x0000aaaabe91f22c llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (./bin/clang+0x458822c)
#14 0x0000aaaabe91ca84 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (./bin/clang+0x4585a84)
#15 0x0000aaaabe91a4f8 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (./bin/clang+0x45834f8)
#16 0x0000aaaabcfde6ec llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (./bin/clang+0x2c476ec)
<...>
Compiler Explorer: https://godbolt.org/z/ePa98xGe1
I see that GCC only supports assembly for this CPU, perhaps that is a sign that codegen here is very difficult?