Skip to content

latest clang on AArch64 OSX doesn't want to hear about the frame pointer #60643

Closed
@regehr

Description

@regehr

Referring to either FP or X29 causes an unfriendly crash using latest Clang on an up-to-date ARM Macbook. the system-provided clang-1400.0.29.202 appears to be happy with this code and works as expected.

__attribute__((noinline)) void test1(void) {
  register unsigned long FP __asm__("fp");
  __asm__ __volatile__("" : "=r" (FP));
}
Johns-MacBook-Pro:code regehr$ clang -c foo.c
Register class not supported
UNREACHABLE executed at /Users/regehr/llvm-project/llvm/lib/Target/AArch64/GISel/AArch64RegisterBankInfo.cpp:283!
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 -c foo.c
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module 'foo.c'.
4.	Running pass 'RegBankSelect' on function '@test1'
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  libLLVMSupport.dylib        0x000000010bae9708 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  libLLVMSupport.dylib        0x000000010bae858c llvm::sys::RunSignalHandlers() + 112
2  libLLVMSupport.dylib        0x000000010bae8b54 llvm::sys::CleanupOnSignal(unsigned long) + 232
3  libLLVMSupport.dylib        0x000000010b9ff124 CrashRecoverySignalHandler(int) + 168
4  libsystem_platform.dylib    0x000000018b1842a4 _sigtramp + 56
5  libsystem_pthread.dylib     0x000000018b155cec pthread_kill + 288
6  libsystem_c.dylib           0x000000018b08e2c8 abort + 180
7  libLLVMSupport.dylib        0x000000010ba115d8 llvm::install_out_of_memory_new_handler() + 0
8  libLLVMAArch64CodeGen.dylib 0x0000000100f918b8 llvm::AArch64RegisterBankInfo::getInstrAlternativeMappings(llvm::MachineInstr const&) const + 0
9  libLLVMAArch64CodeGen.dylib 0x0000000100f92a3c llvm::AArch64RegisterBankInfo::getInstrMapping(llvm::MachineInstr const&) const + 288
10 libLLVMGlobalISel.dylib     0x000000010bd2a96c llvm::RegBankSelect::assignInstr(llvm::MachineInstr&) + 468
11 libLLVMGlobalISel.dylib     0x000000010bd2ae90 llvm::RegBankSelect::assignRegisterBanks(llvm::MachineFunction&) + 340
12 libLLVMGlobalISel.dylib     0x000000010bd2b1f4 llvm::RegBankSelect::runOnMachineFunction(llvm::MachineFunction&) + 356
13 libLLVMCodeGen.dylib        0x000000010944cb2c llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 616
14 libLLVMCore.dylib           0x000000010cad5e38 llvm::FPPassManager::runOnFunction(llvm::Function&) + 704
15 libLLVMCore.dylib           0x000000010cadcb68 llvm::FPPassManager::runOnModule(llvm::Module&) + 60
16 libLLVMCore.dylib           0x000000010cad640c llvm::legacy::PassManagerImpl::run(llvm::Module&) + 764
17 libclangCodeGen.dylib       0x000000010869a480 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::__1::unique_ptr<llvm::raw_pwrite_stream, std::__1::default_delete<llvm::raw_pwrite_stream>>) + 3104
18 libclangCodeGen.dylib       0x0000000108acd648 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 1660
19 libclangParse.dylib         0x000000010f05ffec clang::ParseAST(clang::Sema&, bool, bool) + 724
20 libclangFrontend.dylib      0x000000010a109780 clang::FrontendAction::Execute() + 112
21 libclangFrontend.dylib      0x000000010a08bef4 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 852
22 libclangFrontendTool.dylib  0x00000001033caad4 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 544
23 clang-16                    0x00000001006888a8 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 2116
24 clang-16                    0x0000000100684b80 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) + 1004
25 libclangDriver.dylib        0x000000010a32ca6c void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::__1::optional<llvm::StringRef>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>*, bool*) const::$_1>(long) + 28
26 libLLVMSupport.dylib        0x000000010b9fee18 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) + 168
27 libclangDriver.dylib        0x000000010a32bdd4 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::__1::optional<llvm::StringRef>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>*, bool*) const + 224
28 libclangDriver.dylib        0x000000010a2eef7c clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const + 504
29 libclangDriver.dylib        0x000000010a2ef334 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*>>&, bool) const + 120
30 libclangDriver.dylib        0x000000010a30ca74 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*>>&) + 340
31 clang-16                    0x0000000100682e18 clang_main(int, char**) + 10096
32 dyld                        0x000000018ae2be50 start + 2544
clang-16: error: clang frontend command failed with exit code 134 (use -v to see invocation)
clang version 17.0.0 (git@github.com:llvm/llvm-project.git c32022ad260aa1e6f485c5a6820fa9973f3b108e)
Target: arm64-apple-darwin22.3.0
Thread model: posix
InstalledDir: /Users/regehr/llvm-project/for-alive/bin
clang-16: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-16: note: diagnostic msg: /var/folders/5r/c000d6715f76mgy2qrlkfrq40000gn/T/foo-6c29ca.c
clang-16: note: diagnostic msg: /var/folders/5r/c000d6715f76mgy2qrlkfrq40000gn/T/foo-6c29ca.sh
clang-16: note: diagnostic msg: Crash backtrace is located in
clang-16: note: diagnostic msg: /Users/regehr/Library/Logs/DiagnosticReports/clang-16_<YYYY-MM-DD-HHMMSS>_<hostname>.crash
clang-16: note: diagnostic msg: (choose the .crash file that corresponds to your crash)
clang-16: note: diagnostic msg: 

********************
Johns-MacBook-Pro:code regehr$ 

Metadata

Metadata

Assignees

No one assigned

    Labels

    backend:AArch64crashPrefer [crash-on-valid] or [crash-on-invalid]

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions