| Issue |
56055
|
| Summary |
error in backend: Cannot emit physreg copy instruction for 32-bit address space
|
| Labels |
|
| Assignees |
|
| Reporter |
ararmine
|
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
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs