| Issue |
239861
|
| Summary |
[clang] Assertion `IdealIndex < NumIdealInits && "initializer not found in initializer list"' failed with -Wreorder
|
| Labels |
clang:frontend,
clang:diagnostics,
crash-on-valid,
generated by fuzzer
|
| Assignees |
|
| Reporter |
k-arrows
|
Reproducer:
https://godbolt.org/z/T7oTvGss7
```cpp
template <class T> struct S {
using type = int;
};
template <class T> T &&foo(typename S<T>::type &t);
template <typename... Args> struct F {
int i = (Args() + ... + 0);
};
struct D {
template <typename... Args>
D(Args &&...args) : D(foo<Args>(args)...), F<Args...>() {}
};
```
Backtrace:
```console
clang++: /root/llvm-project/llvm/tools/clang/lib/Sema/SemaDeclCXX.cpp:5813: void DiagnoseBaseOrMemInitializerOrder(clang::Sema&, const clang::CXXConstructorDecl*, llvm::ArrayRef<clang::CXXCtorInitializer*>): Assertion `IdealIndex < NumIdealInits && "initializer not found in initializer list"' 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 -Wreorder <source>
1. <source>:13:59: current parser token '{'
2. <source>:11:1: parsing struct/union/class body 'D'
#0 0x0000000004f17278 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4f17278)
#1 0x0000000004f144d4 llvm::sys::RunSignalHandlers() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4f144d4)
#2 0x0000000004f14b0c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4f14b0c)
#3 0x0000000004e4e888 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#4 0x000072ab04e45330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
#5 0x000072ab04e9ec0c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9ec0c)
#6 0x000072ab04e4527e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
#7 0x000072ab04e288ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
#8 0x000072ab04e2881b (/lib/x86_64-linux-gnu/libc.so.6+0x2881b)
#9 0x000072ab04e3b517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
#10 0x00000000094ad4ad clang::Sema::ActOnMemInitializers(clang::Decl*, clang::SourceLocation, llvm::ArrayRef<clang::CXXCtorInitializer*>, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x94ad4ad)
#11 0x000000000901d41f clang::Parser::ParseConstructorInitializer(clang::Decl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x901d41f)
#12 0x0000000008fb9f55 clang::Parser::ParseFunctionBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x8fb9f55)
#13 0x0000000008fd8690 clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x8fd8690)
#14 0x0000000008fd70bd clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x8fd70bd)
#15 0x000000000902ed26 clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributes&, unsigned int, clang::Decl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x902ed26)
#16 0x00000000090315f0 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-assertions-trunk/bin/clang+++0x90315f0)
#17 0x0000000008fffcca clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::LateParsedAttrList*, clang::ImplicitTypenameContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x8fffcca)
#18 0x0000000008fba587 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x8fba587)
#19 0x0000000008fbb04f clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x8fbb04f)
#20 0x0000000008fc7f68 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x8fc7f68)
#21 0x0000000008fc8e65 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x8fc8e65)
#22 0x0000000008fa4e5a clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x8fa4e5a)
#23 0x0000000005a136f8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5a136f8)
#24 0x0000000005d3ba48 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5d3ba48)
#25 0x0000000005cc859d clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5cc859d)
#26 0x0000000005e12163 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5e12163)
#27 0x0000000001718848 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x1718848)
#28 0x000000000170f72a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>) driver.cpp:0:0
#29 0x000000000170f8b3 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
#30 0x0000000005a8b8e9 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 0x0000000004e4ec84 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4e4ec84)
#32 0x0000000005a8c455 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 0x0000000005a49272 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5a49272)
#34 0x0000000005a4c52c 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+++0x5a4c52c)
#35 0x0000000005a58a25 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5a58a25)
#36 0x0000000001714e7a clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x1714e7a)
#37 0x000000000168c633 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x168c633)
#38 0x000072ab04e2a1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
#39 0x000072ab04e2a28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
#40 0x000000000170f0d5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x170f0d5)
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