| Issue |
239201
|
| Summary |
[clang] Assertion `RD->isAggregate() && "aggregate init on non-aggregate"' failed.
|
| Labels |
clang:frontend,
crash,
generated by fuzzer
|
| Assignees |
|
| Reporter |
k-arrows
|
Reproducer:
https://godbolt.org/z/YMG4odMss
```cpp
#include <utility>
void foo() {
struct S {
std::pair<int, double> foo;
int bar[];
constexpr S(int);
} constexpr bar[]{[0].foo{}};
int baz = bar[1].bar[2];
}
```
Backtrace:
```console
clang++: /root/llvm-project/llvm/tools/clang/lib/Sema/CheckExprLifetime.cpp:794: void clang::sema::visitLocalsRetainedByInitializer(clang::sema::{anonymous}::IndirectLocalPath&, clang::Expr*, clang::sema::{anonymous}::LocalVisitor, bool): Assertion `RD->isAggregate() && "aggregate init on non-aggregate"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and dumped files.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics <source>
1. <source>:9:26: current parser token ';'
2. <source>:3:12: parsing function body 'foo'
3. <source>:3:12: in compound statement ('{}')
#0 0x0000000004efbef8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4efbef8)
#1 0x0000000004ef9154 llvm::sys::RunSignalHandlers() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4ef9154)
#2 0x0000000004ef978c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4ef978c)
#3 0x0000000004e33508 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#4 0x000072ce05645330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
#5 0x000072ce0569ec0c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9ec0c)
#6 0x000072ce0564527e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
#7 0x000072ce056288ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
#8 0x000072ce0562881b (/lib/x86_64-linux-gnu/libc.so.6+0x2881b)
#9 0x000072ce0563b517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
#10 0x0000000009ccf83e clang::sema::visitLocalsRetainedByInitializer(llvm::SmallVectorImpl<clang::sema::(anonymous namespace)::IndirectLocalPathEntry>&, clang::Expr*, llvm::function_ref<bool (llvm::SmallVectorImpl<clang::sema::(anonymous namespace)::IndirectLocalPathEntry>&, clang::Expr*, clang::sema::(anonymous namespace)::ReferenceKind)>, bool) CheckExprLifetime.cpp:0:0
#11 0x0000000009ccf0cc clang::sema::visitLocalsRetainedByInitializer(llvm::SmallVectorImpl<clang::sema::(anonymous namespace)::IndirectLocalPathEntry>&, clang::Expr*, llvm::function_ref<bool (llvm::SmallVectorImpl<clang::sema::(anonymous namespace)::IndirectLocalPathEntry>&, clang::Expr*, clang::sema::(anonymous namespace)::ReferenceKind)>, bool) CheckExprLifetime.cpp:0:0
#12 0x0000000009cd07f3 bool llvm::function_ref<bool (llvm::SmallVectorImpl<clang::sema::(anonymous namespace)::IndirectLocalPathEntry>&, clang::Expr*, clang::sema::(anonymous namespace)::ReferenceKind)>::callback_fn<clang::sema::visitLocalsRetainedByInitializer(llvm::SmallVectorImpl<clang::sema::(anonymous namespace)::IndirectLocalPathEntry>&, clang::Expr*, llvm::function_ref<bool (llvm::SmallVectorImpl<clang::sema::(anonymous namespace)::IndirectLocalPathEntry>&, clang::Expr*, clang::sema::(anonymous namespace)::ReferenceKind)>, bool)::'lambda'(llvm::SmallVectorImpl<clang::sema::(anonymous namespace)::IndirectLocalPathEntry>&, clang::Expr*, clang::sema::(anonymous namespace)::ReferenceKind)>(long, llvm::SmallVectorImpl<clang::sema::(anonymous namespace)::IndirectLocalPathEntry>&, clang::Expr*, clang::sema::(anonymous namespace)::ReferenceKind) CheckExprLifetime.cpp:0:0
#13 0x0000000009cd03b1 clang::sema::visitLocalsRetainedByReferenceBinding(llvm::SmallVectorImpl<clang::sema::(anonymous namespace)::IndirectLocalPathEntry>&, clang::Expr*, clang::sema::(anonymous namespace)::ReferenceKind, llvm::function_ref<bool (llvm::SmallVectorImpl<clang::sema::(anonymous namespace)::IndirectLocalPathEntry>&, clang::Expr*, clang::sema::(anonymous namespace)::ReferenceKind)>) CheckExprLifetime.cpp:0:0
#14 0x0000000009cce8d8 clang::sema::visitLocalsRetainedByInitializer(llvm::SmallVectorImpl<clang::sema::(anonymous namespace)::IndirectLocalPathEntry>&, clang::Expr*, llvm::function_ref<bool (llvm::SmallVectorImpl<clang::sema::(anonymous namespace)::IndirectLocalPathEntry>&, clang::Expr*, clang::sema::(anonymous namespace)::ReferenceKind)>, bool) CheckExprLifetime.cpp:0:0
#15 0x0000000009cd0a7c clang::sema::checkExprLifetimeImpl(clang::Sema&, clang::InitializedEntity const*, clang::InitializedEntity const*, clang::sema::(anonymous namespace)::LifetimeKind, clang::sema::AssignedEntity const*, clang::sema::CapturingEntity const*, clang::Expr*) CheckExprLifetime.cpp:0:0
#16 0x0000000009cd0e2a clang::sema::checkInitLifetime(clang::Sema&, clang::InitializedEntity const&, clang::Expr*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x9cd0e2a)
#17 0x00000000096b5173 clang::InitializationSequence::Perform(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>, clang::QualType*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x96b5173)
#18 0x00000000093ba861 clang::Sema::AddInitializerToDecl(clang::Decl*, clang::Expr*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x93ba861)
#19 0x0000000008fbff61 clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x8fbff61)
#20 0x0000000008fe0a49 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x8fe0a49)
#21 0x0000000008fe1e86 clang::Parser::ParseSimpleDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, bool, clang::Parser::ForRangeInit*, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x8fe1e86)
#22 0x0000000008fe236c clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x8fe236c)
#23 0x0000000009095bd4 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 24u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::LabelDecl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x9095bd4)
#24 0x00000000090964c6 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 24u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::LabelDecl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x90964c6)
#25 0x000000000909ea9e clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x909ea9e)
#26 0x000000000909f28a clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x909f28a)
#27 0x0000000008f952ae clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::LateParsedAttrList*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x8f952ae)
#28 0x0000000008fe14a6 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x8fe14a6)
#29 0x0000000008f88e7b clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x8f88e7b)
#30 0x0000000008f896bf clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x8f896bf)
#31 0x0000000008f965d8 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x8f965d8)
#32 0x0000000008f974d5 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x8f974d5)
#33 0x0000000008f734ca clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x8f734ca)
#34 0x00000000059f69b8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x59f69b8)
#35 0x0000000005d1eb68 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5d1eb68)
#36 0x0000000005cab5dd clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5cab5dd)
#37 0x0000000005df51c3 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5df51c3)
#38 0x0000000001714be8 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x1714be8)
#39 0x000000000170baca ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>) driver.cpp:0:0
#40 0x000000000170bc53 int llvm::function_ref<int (llvm::SmallVectorImpl<char const*>&)>::callback_fn<clang_main(int, char**, llvm::ToolContext const&)::'lambda'(llvm::SmallVectorImpl<char const*>&)>(long, llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#41 0x0000000005a6e949 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
#42 0x0000000004e33904 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4e33904)
#43 0x0000000005a6f4b5 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
#44 0x0000000005a2c2d2 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5a2c2d2)
#45 0x0000000005a2f58c clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5a2f58c)
#46 0x0000000005a3ba85 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5a3ba85)
#47 0x000000000171121a clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x171121a)
#48 0x0000000001686963 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x1686963)
#49 0x000072ce0562a1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
#50 0x000072ce0562a28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
#51 0x000000000170b475 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x170b475)
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
Program terminated with signal SIGABRT (6)
Compiler returned: 134
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs