Open lopippo opened 3 months ago
@llvm/issue-subscribers-clang-frontend
Author: None (lopippo)
Could you please try 19 or main
branch?
Could you please try 19 or
main
branch?
Yes, I'll try to first compile the suite and then check.
One observation that I made right at the moment (do not know if that is useful) is that clangd can parse and check successfully that specific file:
One question: what is that 'tweak: ExtractFunction ==> FAIL: Cannot extract break/continue without corresponding loop/switch statement.' failure message ?
Most sincerely, Filippo
Greetings, sad to say that the crash still occurs with main branch of git repo cloned today: See the attached terminal-output.txt file. Added both diagnostic files as in my first issue post. diagnostic-cpp-hpp-files.zip
Most sincerely, Filippo
You can try to ask about new diagnostics that clangd gives you in #clangd channel on our Discord server. Let's keep this issue for the crash you reported.
You can try to ask about new diagnostics that clangd gives you in #clangd channel on our Discord server. Let's keep this issue for the crash you reported.
Fine, thank your for your responsivenes :-) I deleted my comment above, which looked out-of-context.
[ EDIT ] I have built the whole software again (something must have failed in my first trial) and clangd works flawlessly. I confirm, however, the issue as reported initially.
Most sincerely, Filippo
Confirmed on Clang 20.0: https://godbolt.org/z/vKeEKMEjT Reduced by me and C-Reduce:
struct Ponderable {
void operator==(Ponderable);
};
struct PolChemDefEntity {
void operator==(PolChemDefEntity);
};
struct Sequence {
void operator==(Sequence);
};
struct Ionizable : PolChemDefEntity, Ponderable {
using PolChemDefEntity::operator==;
using Ponderable::operator==;
};
struct Polymer : Sequence, Ionizable {};
using T = decltype(Polymer{} == Polymer{});
Clang 20.0 crash:
clang++: /root/llvm-project/llvm/include/llvm/Support/Casting.h:578:
decltype(auto) llvm::cast(From*) [with To = clang::CXXMethodDecl; From = clang::NamedDecl]:
Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
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-assertions-trunk/bin/clang++ -gdwarf-4 -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 -std=c++17 <source>
1. <source>:20:42: current parser token ')'
#0 0x0000000003afa438 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3afa438)
#1 0x0000000003af812c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3af812c)
#2 0x0000000003a410a8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x0000784f22c42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x0000784f22c969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x0000784f22c42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x0000784f22c287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x0000784f22c2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x0000784f22c39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x0000000006f56c70 clang::Sema::AddMemberOperatorCandidates(clang::OverloadedOperatorKind, clang::SourceLocation, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, clang::OverloadCandidateParamOrder) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6f56c70)
#10 0x0000000006f56e7b clang::Sema::AddMemberOperatorCandidates(clang::OverloadedOperatorKind, clang::SourceLocation, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, clang::OverloadCandidateParamOrder) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6f56e7b)
#11 0x0000000006f5716c clang::Sema::LookupOverloadedBinOp(clang::OverloadCandidateSet&, clang::OverloadedOperatorKind, clang::UnresolvedSetImpl const&, llvm::ArrayRef<clang::Expr*>, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6f5716c)
#12 0x0000000006f62cf0 clang::Sema::CreateOverloadedBinOp(clang::SourceLocation, clang::BinaryOperatorKind, clang::UnresolvedSetImpl const&, clang::Expr*, clang::Expr*, bool, bool, clang::FunctionDecl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6f62cf0)
#13 0x0000000006a81292 BuildOverloadedBinOp(clang::Sema&, clang::Scope*, clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*) SemaExpr.cpp:0:0
#14 0x0000000006b04987 clang::Sema::BuildBinOp(clang::Scope*, clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6b04987)
#15 0x0000000006b05081 clang::Sema::ActOnBinOp(clang::Scope*, clang::SourceLocation, clang::tok::TokenKind, clang::Expr*, clang::Expr*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6b05081)
#16 0x0000000006590707 clang::Parser::ParseRHSOfBinaryExpression(clang::ActionResult<clang::Expr*, true>, clang::prec::Level) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6590707)
#17 0x00000000065938d9 clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x65938d9)
#18 0x000000000656ff5b clang::Parser::ParseDecltypeSpecifier(clang::DeclSpec&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x656ff5b)
#19 0x00000000065a6cec clang::Parser::ParseOptionalCXXScopeSpecifier(clang::CXXScopeSpec&, clang::OpaquePtr<clang::QualType>, bool, bool, bool*, bool, clang::IdentifierInfo const**, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x65a6cec)
#20 0x00000000065166da clang::Parser::TryAnnotateCXXScopeToken(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x65166da)
#21 0x000000000655c232 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x655c232)
#22 0x000000000655d642 clang::Parser::ParseSpecifierQualifierList(clang::DeclSpec&, clang::ImplicitTypenameContext, clang::AccessSpecifier, clang::Parser::DeclSpecContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x655d642)
#23 0x0000000006564620 clang::Parser::ParseTypeName(clang::SourceRange*, clang::DeclaratorContext, clang::AccessSpecifier, clang::Decl**, clang::ParsedAttributes*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6564620)
#24 0x0000000006571e59 clang::Parser::ParseAliasDeclarationAfterDeclarator(clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation, clang::Parser::UsingDeclarator&, clang::SourceLocation&, clang::AccessSpecifier, clang::ParsedAttributes&, clang::Decl**) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6571e59)
#25 0x000000000657bfce clang::Parser::ParseUsingDeclaration(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x657bfce)
#26 0x000000000657cd25 clang::Parser::ParseUsingDirectiveOrDeclaration(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x657cd25)
#27 0x000000000656100f clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x656100f)
#28 0x000000000651de11 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x651de11)
#29 0x000000000651ec9d clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x651ec9d)
#30 0x000000000651213a clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x651213a)
#31 0x000000000440ed18 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x440ed18)
#32 0x000000000469b739 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x469b739)
#33 0x000000000461fc6e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x461fc6e)
#34 0x0000000004784b6e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4784b6e)
#35 0x0000000000ca533f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xca533f)
#36 0x0000000000c9e58a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#37 0x0000000004452389 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
#38 0x0000000003a41554 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3a41554)
#39 0x000000000445297f 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
#40 0x0000000004418515 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4418515)
#41 0x0000000004418f7d 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+++0x4418f7d)
#42 0x0000000004420b95 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4420b95)
#43 0x0000000000ca2735 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xca2735)
#44 0x0000000000b76de4 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xb76de4)
#45 0x0000784f22c29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#46 0x0000784f22c29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#47 0x0000000000c9e03e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc9e03e)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
@llvm/issue-subscribers-c-1
Author: None (lopippo)
@llvm/issue-subscribers-c-11
Author: None (lopippo)
Appears to be a regression in Clang 13: https://godbolt.org/z/8o81jT46z
Remarquable, I need to look at C-reduce !! After one day of research I arrived at the same conclusion this night. Thank you for investigating that as quickly as that! Most sincerely, Filippo
Greetings,
I use Clang as a semantic analyzer in the KDevelop IDE. There are files that make it crash. I researched the problem using 'strace kdevelop' and found that the Clang analyzer was crashing. Then I reconstructed the command line for the analysis of the culprit file and ran that command in the terminal. As per the instructions in the output of the program upon the crash, this is the crash stack (I also attach two diagnostic files, see the end):
And please , see the attached files (as zip archive, because GitHub refuses the files contained therein) as per instruction on the terminal. diagnostic-cpp-hpp-files.zip
Thank you for your guidance to fix this problem, most sincerely Filippo