Issue 240351
Summary Assertion `!FunctionDeclBits.HasDefaultedOrDeletedInfo && "already have this"' failed
Labels clang:frontend, crash-on-valid
Assignees
Reporter gregbedwell
    New regression in the last couple of days.  Bisected to d25851a05ef3acb9a929152625791af53bd32ad3.  Confirmed still present as of d5a665b6383e.

Reduced test-case from a real production codebase:
https://godbolt.org/z/hqqc5TMn3

```
template <typename = int> struct a {
  a();
};
template <typename b> a<b>::a() = default;
template <typename f, typename g> __attribute__((optnone)) void h(f, g) {}
void i(int j) {
  h(j, j);
  a k;
}
```

```
clang++: /root/llvm-project/llvm/tools/clang/lib/AST/Decl.cpp:3167: void clang::FunctionDecl::setDefaultedOrDeletedInfo(clang::FunctionDecl::DefaultedOrDeletedFunctionInfo*): Assertion `!FunctionDeclBits.HasDefaultedOrDeletedInfo && "already have this"' 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.	<eof> parser at end of file
2.	<source>:4:29: instantiating function definition 'a<>::a'
 #0 0x0000000004f29ef8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4f29ef8)
 #1 0x0000000004f27154 llvm::sys::RunSignalHandlers() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4f27154)
 #2 0x0000000004f2778c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4f2778c)
 #3 0x0000000004e61768 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #4 0x0000757f84645330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
 #5 0x0000757f8469ec0c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9ec0c)
 #6 0x0000757f8464527e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
 #7 0x0000757f846288ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
 #8 0x0000757f8462881b (/lib/x86_64-linux-gnu/libc.so.6+0x2881b)
 #9 0x0000757f8463b517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
#10 0x000000000a242f43 (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xa242f43)
#11 0x00000000094ebd55 clang::Sema::SetDeclDefaulted(clang::Decl*, clang::SourceLocation, clang::Scope*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x94ebd55)
#12 0x0000000009c90ea5 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x9c90ea5)
#13 0x0000000009c8eda7 clang::Sema::PerformPendingInstantiations(bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x9c8eda7)
#14 0x00000000091991b2 clang::Sema::ActOnEndOfTranslationUnitFragment(clang::TUFragmentKind) (.part.0) Sema.cpp:0:0
#15 0x00000000091994f2 clang::Sema::ActOnEndOfTranslationUnit() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x91994f2)
#16 0x0000000008ff167a clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x8ff167a)
#17 0x0000000008fcd41a clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x8fcd41a)
#18 0x0000000005a29058 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5a29058)
#19 0x0000000005d513a8 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5d513a8)
#20 0x0000000005cddefd clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5cddefd)
#21 0x0000000005e27b23 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5e27b23)
#22 0x000000000171b228 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x171b228)
#23 0x000000000171210a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>) driver.cpp:0:0
#24 0x0000000001712293 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
#25 0x0000000005aa1249 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
#26 0x0000000004e61b64 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4e61b64)
#27 0x0000000005aa1db5 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
#28 0x0000000005a5ebd2 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5a5ebd2)
#29 0x0000000005a61e8c 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+++0x5a61e8c)
#30 0x0000000005a6e385 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5a6e385)
#31 0x000000000171785a clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x171785a)
#32 0x00000000016909b3 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x16909b3)
#33 0x0000757f8462a1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
#34 0x0000757f8462a28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
#35 0x0000000001711ab5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x1711ab5)
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

Reply via email to