<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/56055>56055</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
error in backend: Cannot emit physreg copy instruction for 32-bit address space
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ararmine
</td>
</tr>
</table>
<pre>
The following C++ example using 32-bit address space crashes in back-end:
```
void f(char * __ptr32 text)
{
text += 2;
}
```
Checked with **X86-64 clang 14.0.0**.
Command to run:
`clang test.cpp -S -fms-extensions`
Here is the crash:
```
fatal error: error in backend: Cannot emit physreg copy instruction
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-14.0.0/bin/clang++ -gdwarf-4 -g -o /app/output.s -S --gcc-toolchain=/opt/compiler-explorer/gcc-11.2.0 -fcolor-diagnostics -fno-crash-diagnostics -fms-extensions <source>
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module '<source>'.
4. Running pass 'Post-RA pseudo instruction expansion pass' on function '@_Z1fPU10ptr32_sptrc'
#0 0x00005556c6f7de8f PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
#1 0x00005556c6f7bd60 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x357bd60)
#2 0x00005556c6eb72d2 llvm::CrashRecoveryContext::HandleExit(int) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x34b72d2)
#3 0x00005556c6f7492e llvm::sys::Process::Exit(int, bool) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x357492e)
#4 0x00005556c4b99696 (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x1199696)
#5 0x00005556c6ebe7ff llvm::report_fatal_error(llvm::Twine const&, bool) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x34be7ff)
#6 0x00005556c6ebe988 (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x34be988)
#7 0x00005556c5d1e3c1 llvm::X86InstrInfo::copyPhysReg(llvm::MachineBasicBlock&, llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>, llvm::DebugLoc const&, llvm::MCRegister, llvm::MCRegister, bool) const (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x231e3c1)
#8 0x00005556c653d3e5 (anonymous namespace)::ExpandPostRA::runOnMachineFunction(llvm::MachineFunction&) ExpandPostRAPseudos.cpp:0:0
#9 0x00005556c6283638 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x2883638)
#10 0x00005556c66e8ca9 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x2ce8ca9)
#11 0x00005556c66e8f41 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x2ce8f41)
#12 0x00005556c66e99e7 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x2ce99e7)
#13 0x00005556c72ace84 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> >) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x38ace84)
#14 0x00005556c7f0592f clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x450592f)
#15 0x00005556c8d9aa79 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x539aa79)
#16 0x00005556c7f05b02 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x4505b02)
#17 0x00005556c7901161 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x3f01161)
#18 0x00005556c789c2f2 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x3e9c2f2)
#19 0x00005556c79cc853 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x3fcc853)
#20 0x00005556c4b9b1d4 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x119b1d4)
#21 0x00005556c4b9718d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#22 0x00005556c77375f5 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#23 0x00005556c6eb7163 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x34b7163)
#24 0x00005556c77396c8 clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x3d396c8)
#25 0x00005556c770cb1a clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x3d0cb1a)
#26 0x00005556c770d65f clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x3d0d65f)
#27 0x00005556c7716005 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x3d16005)
#28 0x00005556c4aa80b2 main (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x10a80b2)
#29 0x00007f83a272c0b3 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x240b3)
#30 0x00005556c4b96d0a _start (/opt/compiler-explorer/clang-14.0.0/bin/clang+++0x1196d0a)
clang-14: error: clang frontend command failed with exit code 70 (use -v to see invocation)
ASM generation compiler returned: 70
fatal error: error in backend: Cannot emit physreg copy instruction
clang-14: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Execution build compiler returned: 70
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzlWUtz2zgS_jXyBSUV34-DD7Icb7KVVFSWZ2trLyoQBCVuKIALgIn977cBkBJBy0lmhpk9rEu2KTy6v_7Q6G6ABS9fbp-OFFW8afi3mh3QZhHcwQfRZ3xqG4o6qVvDYFnUCuGyFFRKJFtMKCICyyOVqGaowOTLkrJyEa4X3v3CG_4mXv8xX7_yukTVIsjIEQu0CNZov2-VCAOk6LNaBHk_K72zDwh-dA_SmMJ7FCzCu2HI_VUNmyMlX2iJvtXqqBXA559ZskwiRBoMdvjRylt5tmPVT-GnE2YlUhyJjr02wE5UVKoVaVu03KFldZJLgEWZrDmTZ-X273sqKKolUseeoYtIF2uFFW4QFYILGGIfBi4tlWiDGeMK0RNw3x5fpKAHRHj7AsOkEh1RoN8K2358t969Q7Ir9FiMiu6ABG25UNqwo1Kt1DiCB_gcgJyuWBF-gi9N83X4t2wF_zclsBAPtZQdlfCANDU1I01X0otJBqMS4ASLYINaUCQ4AccA5iXvhG3WM7GUnNRYQQeQiyQRdat64ncKhKCyO7VnhjzoyreCHwQ-ISwO3YkypYHDWj7wViMD1G3dUAEL0DZcUKHb9BIth7V9KGo2NPbOvDyU37ColhE8oSXX0nDbapmdaju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