<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/82859>82859</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
"Type punning" some aarch64 SVE via pointers causes an internal compiler error
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
pinskia
</td>
</tr>
</table>
<pre>
Take:
```
#include <arm_sve.h>
svint8_t f(svuint8x4_t s) {
return *reinterpret_cast<svint8_t*>(&s);
}
```
Will cause an internal compile error:
```
fatal error: error in backend: Invalid size request on a scalable vector.
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-trunk/bin/clang++ -gdwarf-4 -g -o /app/output.s -S -target aarch64-linux-gnu --gcc-toolchain=/opt/compiler-explorer/arm64/gcc-12.2.0/aarch64-unknown-linux-gnu --sysroot=/opt/compiler-explorer/arm64/gcc-12.2.0/aarch64-unknown-linux-gnu/aarch64-unknown-linux-gnu/sysroot -fcolor-diagnostics -fno-crash-diagnostics -march=armv9-a+sve2 -O1 <source>
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module '<source>'.
4. Running pass 'AArch64 Instruction Selection' on function '@_Z1f11svuint8x4_t'
#0 0x0000000003624838 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3624838)
#1 0x0000000003622984 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3622984)
#2 0x0000000003570323 llvm::CrashRecoveryContext::HandleExit(int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3570323)
#3 0x000000000361a36e llvm::sys::Process::Exit(int, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x361a36e)
#4 0x0000000000c22476 (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc22476)
#5 0x0000000003579373 llvm::report_fatal_error(llvm::Twine const&, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3579373)
#6 0x00000000035794d8 (/opt/compiler-explorer/clang-trunk/bin/clang+++0x35794d8)
#7 0x00000000035c8a4d (/opt/compiler-explorer/clang-trunk/bin/clang+++0x35c8a4d)
#8 0x00000000035c8a6c llvm::TypeSize::operator unsigned long() const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x35c8a6c)
#9 0x000000000465b796 llvm::SelectionDAGBuilder::EmitFuncArgumentDbgValue(llvm::Value const*, llvm::DILocalVariable*, llvm::DIExpression*, llvm::DILocation*, llvm::SelectionDAGBuilder::FuncArgumentDbgValueKind, llvm::SDValue const&)::'lambda0'(llvm::ArrayRef<std::pair<unsigned int, llvm::TypeSize>>)::operator()(llvm::ArrayRef<std::pair<unsigned int, llvm::TypeSize>>) const SelectionDAGBuilder.cpp:0:0
#10 0x0000000004674246 llvm::SelectionDAGBuilder::EmitFuncArgumentDbgValue(llvm::Value const*, llvm::DILocalVariable*, llvm::DIExpression*, llvm::DILocation*, llvm::SelectionDAGBuilder::FuncArgumentDbgValueKind, llvm::SDValue const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4674246)
#11 0x00000000046750e1 llvm::SelectionDAGBuilder::handleDebugValue(llvm::ArrayRef<llvm::Value const*>, llvm::DILocalVariable*, llvm::DIExpression*, llvm::DebugLoc, unsigned int, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x46750e1)
#12 0x0000000004679567 llvm::SelectionDAGBuilder::visitDbgInfo(llvm::Instruction const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4679567)
#13 0x00000000046b48d9 llvm::SelectionDAGBuilder::visit(llvm::Instruction const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x46b48d9)
#14 0x000000000472dd16 llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void, true>, false, true>, llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void, true>, false, true>, bool&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x472dd16)
#15 0x000000000472f348 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x472f348)
#16 0x0000000004731b29 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.0) SelectionDAGISel.cpp:0:0
#17 0x0000000002ab83b0 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#18 0x0000000002fe9a52 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x2fe9a52)
#19 0x0000000002fe9bd1 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x2fe9bd1)
#20 0x0000000002feb7f0 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x2feb7f0)
#21 0x0000000003892149 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::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3892149)
#22 0x0000000003e6cfb1 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3e6cfb1)
#23 0x0000000005cf7719 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5cf7719)
#24 0x0000000003e6c415 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3e6c415)
#25 0x0000000004100a51 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4100a51)
#26 0x000000000407d00b clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x407d00b)
#27 0x00000000041e2c33 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x41e2c33)
#28 0x0000000000c242a6 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc242a6)
#29 0x0000000000c1cbdd ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#30 0x0000000003eb39f9 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
#31 0x0000000003570223 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3570223)
#32 0x0000000003eb3c19 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
#33 0x0000000003e7b9f7 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3e7b9f7)
#34 0x0000000003e7c3ad clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3e7c3ad)
#35 0x0000000003e8610c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3e8610c)
#36 0x0000000000c21521 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc21521)
#37 0x0000000000b18064 main (/opt/compiler-explorer/clang-trunk/bin/clang+++0xb18064)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWl9v2zgS_zTKC2FDomRLesiDYye73euiRZ3rAfdiUNTI5oUitSTlJPvpD9QfW1TtNLunLg64K5rEJqnhj7-Z4QyHIlqzvQC49RZ33mJzQ2pzkOq2YkI_MXKTyfz19pE8gReuPH_j-Stv6Xf_2684ZILyOgfkhWuiyp0-wvzghfddf_NbH5kwyc6gwsOJPtb220u0M0h7OEVefNcPThWYWgnk4ZUCJgyoSoHZUaKNF657MR5e2Qlw4uGlleCFvYB4cxll8_sfjHNESa0BEYEa6YJwRGVZMQ4IlJLq2joLYgg_DWk_ICZQRugTiNy2fRBHwlmONPsdkILfatAGSYEI0pRwknFAR6BGqnkr8vPH-9X2Huk6K5lBBGX1HimopDLISHQwptIWDX7w8MOemUOdzaksPfzA-bH_M6uU_BdQ4-EHpnUN2sMPiIgc9UoxB0BUEX1okBpFKHh4jSoFlZIUtIYcaVmrttk-SbSWlBEDOVK1QJoqVpkO8tYQ-oTyuqxOPPlzz08_K7lXpERE7esShLHAkYcfZGWRdQSrGbxUXCpQto0TsZ8ZVYsnDz9kTPRtHr7z8B2a7fNnoopZhGZ7NJNWGKkqK7I2VW3mGs22aGaI2oNBhCh6WEYzzkT9MtuLGs1me0pnRkpOD4QJL9y8iYaochlZmimdBXiO575t7KTW4knIZ-FI169aSWmmlfudvm5ONCuo5FLNckb2QmrDqEazQshZo2e3ubTyvHBDVHlMZ8TDd_oIGM0-BdZdO8X3vhpYVXrhGmThhfeoIkqDQsQgEDmSBSoYh3YktiPXMge0BwGKGCZF2xPani-1EEzsUUW0Rh6OH2pB7RD02Tb8SgT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