<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/150362>150362</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang trunk crashed with aligned and address_space attribute on bitint. fatal error: error in backend: cannot lower memory intrinsic in address space 256.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
iamanonymouscs
</td>
</tr>
</table>
<pre>
clang trunk crashed with `aligned` and `address_space` attribute on `bitint`.
Compiler explorer: https://godbolt.org/z/4q3vqM3vn
```
$cat mutant.c
struct c {
_BitInt(10) a;
} __attribute__((aligned(256)));
struct d {
struct c b[];
};
__attribute__((address_space(256))) struct d e;
struct c f;
void g() { e.b[0] = f; }
```
The full stack dump:
```
fatal error: error in backend: cannot lower memory intrinsic in address space 256
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 -gdwarf-4 -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 -g0 <source>
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module '<source>'.
4. Running pass 'X86 DAG->DAG Instruction Selection' on function '@g'
#0 0x0000000003fc9168 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3fc9168)
#1 0x0000000003fc6594 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3fc6594)
#2 0x0000000003f0b2c6 llvm::CrashRecoveryContext::HandleExit(int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3f0b2c6)
#3 0x0000000003fbda7e llvm::sys::Process::Exit(int, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3fbda7e)
#4 0x0000000000d9d660 LLVMErrorHandler(void*, char const*, bool) cc1_main.cpp:0:0
#5 0x0000000003f16123 llvm::report_fatal_error(llvm::Twine const&, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3f16123)
#6 0x00000000055aac6a (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x55aac6a)
#7 0x00000000055aac95 checkAddrSpaceIsValidForLibcall(llvm::TargetLowering const*, unsigned int) SelectionDAG.cpp:0:0
#8 0x0000000005605a65 llvm::SelectionDAG::getMemcpy(llvm::SDValue, llvm::SDLoc const&, llvm::SDValue, llvm::SDValue, llvm::SDValue, llvm::Align, bool, bool, llvm::CallInst const*, std::optional<bool>, llvm::MachinePointerInfo, llvm::MachinePointerInfo, llvm::AAMDNodes const&, llvm::BatchAAResults*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5605a65)
#9 0x000000000558d7cf llvm::SelectionDAGBuilder::visitIntrinsicCall(llvm::CallInst const&, unsigned int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x558d7cf)
#10 0x00000000055915c3 llvm::SelectionDAGBuilder::visitCall(llvm::CallInst const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x55915c3)
#11 0x00000000055a49e4 llvm::SelectionDAGBuilder::visit(llvm::Instruction const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x55a49e4)
#12 0x0000000005638e1d llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void, true, llvm::BasicBlock>, false, true>, llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void, true, llvm::BasicBlock>, false, true>, bool&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5638e1d)
#13 0x0000000005639c34 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5639c34)
#14 0x000000000563b245 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x563b245)
#15 0x0000000005626c0f llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5626c0f)
#16 0x00000000032d47f3 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#17 0x00000000038fb79f llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x38fb79f)
#18 0x00000000038fbb51 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x38fbb51)
#19 0x00000000038fc3c1 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x38fc3c1)
#20 0x000000000427a8b1 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+0x427a8b1)
#21 0x0000000004976d03 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4976d03)
#22 0x000000000666d5bc clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x666d5bc)
#23 0x0000000004977108 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4977108)
#24 0x0000000004c69e45 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4c69e45)
#25 0x0000000004be6b3e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4be6b3e)
#26 0x0000000004d5db71 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4d5db71)
#27 0x0000000000d9fd9f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xd9fd9f)
#28 0x0000000000d969fa ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#29 0x00000000049de109 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
#30 0x0000000003f0b204 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3f0b204)
#31 0x00000000049de71f 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
#32 0x00000000049a0ced clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x49a0ced)
#33 0x00000000049a1d7e 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+0x49a1d7e)
#34 0x00000000049a9de5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x49a9de5)
#35 0x0000000000d9c24f clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xd9c24f)
#36 0x0000000000c50784 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xc50784)
#37 0x000075587ac29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#38 0x000075587ac29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#39 0x0000000000d964a5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xd964a5)
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Compiler returned: 70
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzkWltz27oR_jXwC0YaCrw_-IGWrTRn7MYTu5m-cUAAlNCAgA4A-tJf3wFIiRfLOU6rnGmnGWdE4bL49sNid7kCNoZvJWOXIL4C8fUFbu1O6UuOGyyVfG1Ua4i5qBR9vSQCyy20upXfIdHY7BiFz9zuIEgCLJwUCpIAYkl9C6WaGVOaPSbMt1uredVaBpV0AypuubQgCZYgKEBQrFWz54JpyF72QmmmQVjAnbV7A8ICoA1Am62ilRJ2qfQWoM0_AdpEv4dPv9-FT7KTAZKg_wsKgCKCLWxai6VdEhAUxuqWWEggSK9AUEBYXnH7WVqAslUAUA4xCF0HSK9hWR7xliVAGUDZQUeUoTgBKO___JReND2KPq5VdcQeJXcPp8RPCJsuAo_y2WQ9Auvu-5PiFG69oNxhgGzpFg5AfA1BeO2HQbf6jKOgeNwxWLdCQGMx-Q5p2-wd39NxNbZYQKa18rviHyCXsMLkO5PUtREspbJQqGemYcMapV8hl1ZzaThxY3v9oNcPOu2C4v72pni4gaatGm4hhlW7hZrtlbbQqvnmc7trqyVRDUAbIZ4OH4u9Vv9gxAK04ca0zAC08UbIJREtZdDuWGevHq7Vnt413Gu214owYxiFRrW6a3YzsTGKcGwZhbqV0BDN99aZ6cOMI2e7-b1WW40biPW2bZi0DjIEaKP2DhPpzXpxNGu08SdpgY1h2nIlzcIfKoA2FZeHbrjY0mes60UEF1u4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