<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/107527>107527</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang segmentation fault when compiling SVE code under macOS
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
SadiinsoSnowfall
</td>
</tr>
</table>
<pre>
Compiling the following snippet on `clang 18.1.8`, installed via homebrew on macOS, causes a segfault when targeting SVE (any vector width):
```c++
#include <arm_sve.h>
void test(svbool_t t, svint32_t a, svint32_t b) {
svsub_s32_m(t, a, b);
}
int main() {}
```
The code was compiled using the following command:
```
clang -march=armv8-a+sve -msve-vector-bits=128 test.cpp
```
Compiler output:
```
PLEASE submit a bug report to https://github.com/Homebrew/homebrew-core/issues and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /opt/homebrew/Cellar/llvm/18.1.8/bin/clang-18 -cc1 -triple arm64-apple-macosx15.0.0 -Wundef-prefix=TARGET_OS_ -Werror=undef-prefix -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -dumpdir a- -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name test.cpp -mrelocation-model pic -pic-level 2 -mframe-pointer=non-leaf -ffp-contract=on -fno-rounding-math -funwind-tables=1 -fcompatibility-qualified-id-block-type-checking -fvisibility-inlines-hidden-static-local-var -fbuiltin-headers-in-system-modules -fdefine-target-os-macros -target-cpu apple-m1 -target-feature +zcm -target-feature +zcz -target-feature +v8a -target-feature +fp-armv8 -target-feature +fullfp16 -target-feature +neon -target-feature +sve -target-abi darwinpcs -mvscale-max=1 -mvscale-min=1 -debugger-tuning=lldb -fdebug-compilation-dir=/tmp -target-linker-version 1053.12 -fcoverage-compilation-dir=/tmp -resource-dir /opt/homebrew/Cellar/llvm/18.1.8/lib/clang/18 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -internal-isystem /opt/homebrew/opt/llvm/bin/../include/c++/v1 -internal-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/local/include -internal-isystem /opt/homebrew/Cellar/llvm/18.1.8/lib/clang/18/include -internal-externc-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include -fdeprecated-macro -ferror-limit 19 -stack-protector 1 -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fmax-type-align=16 -fcolor-diagnostics -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /var/folders/_c/4w43161s72x8kd5w24cp7vlm0000gn/T/test-789251.o -x c++ test.cpp
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module 'test.cpp'.
4. Running pass 'AArch64 Instruction Selection' on function '@_Z4testu10__SVBool_tu11__SVInt32_tS0_'
#0 0x0000000118c7dd60 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/homebrew/Cellar/llvm/18.1.8/lib/libLLVM.dylib+0x4695d60)
#1 0x0000000118c7e134 SignalHandler(int) (/opt/homebrew/Cellar/llvm/18.1.8/lib/libLLVM.dylib+0x4696134)
#2 0x000000018388c184 (/usr/lib/system/libsystem_platform.dylib+0x180484184)
#3 0x0000000116b7a3b8 llvm::AArch64TargetLowering::LowerFormalArguments(llvm::SDValue, unsigned int, bool, llvm::SmallVectorImpl<llvm::ISD::InputArg> const&, llvm::SDLoc const&, llvm::SelectionDAG&, llvm::SmallVectorImpl<llvm::SDValue>&) const (/opt/homebrew/Cellar/llvm/18.1.8/lib/libLLVM.dylib+0x25923b8)
#4 0x00000001151f4648 llvm::SelectionDAGISel::LowerArguments(llvm::Function const&) (/opt/homebrew/Cellar/llvm/18.1.8/lib/libLLVM.dylib+0xc0c648)
#5 0x000000011527faf8 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/homebrew/Cellar/llvm/18.1.8/lib/libLLVM.dylib+0xc97af8)
#6 0x000000011527e578 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/homebrew/Cellar/llvm/18.1.8/lib/libLLVM.dylib+0xc96578)
#7 0x0000000114c41054 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/opt/homebrew/Cellar/llvm/18.1.8/lib/libLLVM.dylib+0x659054)
#8 0x00000001148fc0e4 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/homebrew/Cellar/llvm/18.1.8/lib/libLLVM.dylib+0x3140e4)
#9 0x00000001148f03ec llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/homebrew/Cellar/llvm/18.1.8/lib/libLLVM.dylib+0x3083ec)
#10 0x00000001085220cc 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>>, clang::BackendConsumer*) (/opt/homebrew/Cellar/llvm/18.1.8/lib/libclang-cpp.dylib+0x15960cc)
#11 0x00000001088c7644 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/homebrew/Cellar/llvm/18.1.8/lib/libclang-cpp.dylib+0x193b644)
#12 0x00000001071970f8 clang::ParseAST(clang::Sema&, bool, bool) (/opt/homebrew/Cellar/llvm/18.1.8/lib/libclang-cpp.dylib+0x20b0f8)
#13 0x0000000109028dd4 clang::FrontendAction::Execute() (/opt/homebrew/Cellar/llvm/18.1.8/lib/libclang-cpp.dylib+0x209cdd4)
#14 0x0000000108fabad4 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/homebrew/Cellar/llvm/18.1.8/lib/libclang-cpp.dylib+0x201fad4)
#15 0x000000010907bc28 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/homebrew/Cellar/llvm/18.1.8/lib/libclang-cpp.dylib+0x20efc28)
#16 0x0000000102526b28 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/homebrew/Cellar/llvm/18.1.8/bin/clang-18+0x100006b28)
#17 0x0000000102525218 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) (/opt/homebrew/Cellar/llvm/18.1.8/bin/clang-18+0x100005218)
#18 0x0000000102523dac clang_main(int, char**, llvm::ToolContext const&) (/opt/homebrew/Cellar/llvm/18.1.8/bin/clang-18+0x100003dac)
#19 0x0000000102530e38 main (/opt/homebrew/Cellar/llvm/18.1.8/bin/clang-18+0x100010e38)
#20 0x00000001834d4274
clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal (use -v to see invocation)
Homebrew clang version 18.1.8
Target: arm64-apple-darwin24.1.0
Thread model: posix
InstalledDir: /opt/homebrew/opt/llvm/bin
```
This issue might be related to #49751, and manifested under `clang 18.1.8` on macOS 15.1 on an apple M3 based machine.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8WV9z2ziS_zT0CwoqEqRE6sEPsmTNpC6ppCJf5upeVCDYpLAGAS4AyvJ--isAlEzacrJ745mUKyIbYOPXjf4HNDWGNxLgNprfRfPNDe3tQenbHa04l0btpHqqqRA3paqeb9eq7bjgskH2AKhWQqgn92Yk7zqwSEkULWImqGxQUsySWREt4oisEZfGUiGgQkdO0UG1UGp4cvNbyr7u3BRGewMGUWSgqWkvLHo6gESW6gasW2T34x5FpKDyGR2BWaXRE6_sISLLKF1F8SaKV241_8cicuf-ApWkXDLRV4CidE11uzdHmB2i9H4Y9_8fFa-QBWMjUphjqZTYW2QdMnPk0qZkbxGdvpYRWaIoH5ZBCCFzNH25NynZtxEp_Nf-m9KjPOPJN-OFubSopVxGpDjzu0w4yxNeHw6AmKoAPVGDmN8LqFBv3m4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