[clang][AArch64] Crash when compiling a class member function annotated with target_version
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Reproducer:
https://godbolt.org/z/c3P3Y3WdW
```cpp
class C {
int __attribute__ ((target_version("fp16"))) foo() { return 1; }
};
```
Backtrace:
```console
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++ -g -o /app/output.s -fno-verbose-asm -S -target aarch64-linux-gnu --gcc-toolchain=/opt/compiler-explorer/arm64/gcc-15.2.0/aarch64-unknown-linux-gnu --sysroot=/opt/compiler-explorer/arm64/gcc-15.2.0/aarch64-unknown-linux-gnu/aarch64-unknown-linux-gnu/sysroot -fcolor-diagnostics -fno-crash-diagnostics
1. :2:56: current parser token 'return'
2. :1:1: parsing struct/union/class body 'C'
3. :2:54: parsing function body 'C::foo'
4. :2:54: in compound statement ('{}')
#0 0x0000000003e340f8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3e340f8)
#1 0x0000000003e31adc llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3e31adc)
#2 0x0000000003d73f78 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007988ada42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x0000000000ca74d0 clang::Sema::PushCompoundScope(bool) (.cold) Sema.cpp:0:0
#5 0x00000000065d09b3 clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x65d09b3)
#6 0x00000000065d182a clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x65d182a)
#7 0x00000000064d3c8a clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x64d3c8a)
#8 0x00000000064d395d clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x64d395d)
#9 0x000000000652c800 clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributes&, unsigned int, clang::Decl*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x652c800)
#10 0x000000000652e6ba clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x652e6ba)
#11 0x00000000064f7ce1 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::LateParsedAttrList*, clang::ImplicitTypenameContext) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x64f7ce1)
#12 0x00000000064b319b clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x64b319b)
#13 0x00000000064b3c3f clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x64b3c3f)
#14 0x00000000064bc52f clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x64bc52f)
#15 0x00000000064bde37 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x64bde37)
#16 0x00000000064be1a0 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x64be1a0)
#17 0x0000000006496bb3 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x6496bb3)
#18 0x0000000004831675 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4831675)
#19 0x0000000004b7238a clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4b7238a)
#20 0x0000000004aef645 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4aef645)
#21 0x0000000004c6b70b clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4c6b70b)
#22 0x0000000000e0ebb8 cc1_main(llvm::ArrayRef, char const*, void*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xe0ebb8)
#23 0x0000000000e068bb ExecuteCC1Tool(llvm::SmallVectorImpl&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr) driver.cpp:0:0
#24 0x0000000000e0695d int llvm::function_ref&)>::callback_fn&)>(long, llvm::SmallVectorImpl&) driver.cpp:0:0
#25 0x00000000048a5f69 void llvm::function_ref::callback_fn>, std::__cxx11::basic_string, std::allocator>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#26 0x0000000003d74333 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3d74333)
#27 0x00000000048a6189 clang::driver::CC1Command::Execute(llvm::ArrayRef>, std::__cxx11::basic_string, std::allocator>*, bool*) const (.part.0) Job.cpp:0:0
#28 0x0000000004867172 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4867172)
#29 0x0000000004868051 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl>&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4868051)
#30 0x0000000004870dec clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl>&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4870dec)
#31 0x0000000000e0b3d1 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xe0b3d1)
#32 0x0000000000cb48ba main (/opt/compiler-explorer/clang-trunk/bin/clang+++0xcb48ba)
#33 0x00007988ada29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#34 0x00007988ada29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#35 0x0000000000e06355 _start (/opt/compiler-explorer/clang-trunk/bin/clang+++0xe06355)
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
Compiler returned: 139
```
Contributor guide
Assessment
This issue has not been assessed yet.