Issue |
60205
|
Summary |
[AVR] clang crashes with fatal error on reading object from flash address_space
|
Labels |
|
Assignees |
|
Reporter |
sprintersb
|
Compile with `-target avr -S -Os -mmcu=atmega2560` the following test case:
```c++
typedef struct { char a, b, c[7]; } abc_t;
#ifdef __clang__
#define __flash __attribute__((__address_space__(1)))
#endif
#define T abc_t
T get_T (const __flash T *p)
{
return *p;
}
void copy_T (const __flash T *p, T *dest)
{
*dest = *p;
}
```
```
fatal error: error in backend: cannot lower memory intrinsic in address space 1
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: clang-16 --target=avr foo.c -S -Os -mmcu=atmega2560
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module 'foo.c'.
4. Running pass 'AVR DAG->DAG Instruction Selection' on function '@get_T'
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 libLLVM-16.so.1 0x00007fad07a4e326 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 54
1 libLLVM-16.so.1 0x00007fad07a4c460 llvm::sys::RunSignalHandlers() + 80
2 libLLVM-16.so.1 0x00007fad07a4d9c4 llvm::sys::CleanupOnSignal(unsigned long) + 244
3 libLLVM-16.so.1 0x00007fad0798c90e
4 libLLVM-16.so.1 0x00007fad0798c8cb
5 libLLVM-16.so.1 0x00007fad07a48d67 llvm::sys::Process::Exit(int, bool) + 39
6 clang-16 0x00005610113c32b4
7 libLLVM-16.so.1 0x00007fad0799a3fb llvm::report_fatal_error(llvm::Twine const&, bool) + 299
8 libLLVM-16.so.1 0x00007fad0820924c llvm::SelectionDAG::getMemcpy(llvm::SDValue, llvm::SDLoc const&, llvm::SDValue, llvm::SDValue, llvm::SDValue, llvm::Align, bool, bool, bool, llvm::MachinePointerInfo, llvm::MachinePointerInfo, llvm::AAMDNodes const&, llvm::AAResults*) + 2348
9 libLLVM-16.so.1 0x00007fad081cb4ee llvm::SelectionDAGBuilder::visitIntrinsicCall(llvm::CallInst const&, unsigned int) + 29710
10 libLLVM-16.so.1 0x00007fad0819d4cb llvm::SelectionDAGBuilder::visit(llvm::Instruction const&) + 459
11 libLLVM-16.so.1 0x00007fad0822fee6 llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void>, false, true>, llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void>, false, true>, bool&) + 326
12 libLLVM-16.so.1 0x00007fad0822f987 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 5047
13 libLLVM-16.so.1 0x00007fad0822d9b1 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 1825
14 libLLVM-16.so.1 0x00007fad07dd1c2b llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 635
15 libLLVM-16.so.1 0x00007fad07b845ad llvm::FPPassManager::runOnFunction(llvm::Function&) + 653
16 libLLVM-16.so.1 0x00007fad07b8a203 llvm::FPPassManager::runOnModule(llvm::Module&) + 51
17 libLLVM-16.so.1 0x00007fad07b84c65 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 965
18 libclang-cpp.so.16 0x00007fad0fac8c32 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) + 4034
19 libclang-cpp.so.16 0x00007fad0fe2514f
20 libclang-cpp.so.16 0x00007fad0ebaa832 clang::ParseAST(clang::Sema&, bool, bool) + 850
21 libclang-cpp.so.16 0x00007fad107c8a75 clang::FrontendAction::Execute() + 85
22 libclang-cpp.so.16 0x00007fad107465e4 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 724
23 libclang-cpp.so.16 0x00007fad10840d94 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 660
24 clang-16 0x00005610113c2c4e cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 2302
25 clang-16 0x00005610113bffb0
26 libclang-cpp.so.16 0x00007fad10425f42
27 libLLVM-16.so.1 0x00007fad0798c8ac llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) + 140
28 libclang-cpp.so.16 0x00007fad10425663 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const + 355
29 libclang-cpp.so.16 0x00007fad103f0e12 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const + 866
30 libclang-cpp.so.16 0x00007fad103f106e clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const + 142
31 libclang-cpp.so.16 0x00007fad1040b89d clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) + 349
32 clang-16 0x00005610113bf665 clang_main(int, char**) + 11541
33 libc.so.6 0x00007fad06567d90
34 libc.so.6 0x00007fad06567e40 __libc_start_main + 128
35 clang-16 0x00005610113bc60e _start + 46
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Ubuntu clang version 16.0.0 (++20230118052744+29d25f9e9a4c-1~exp1~20230118172840.512)
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs