Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugprone-virtual-near-miss: Crash with template template parameter #48674

Closed
VReichelt opened this issue Feb 23, 2021 · 4 comments
Closed

bugprone-virtual-near-miss: Crash with template template parameter #48674

VReichelt opened this issue Feb 23, 2021 · 4 comments
Labels
bugzilla Issues migrated from bugzilla clang-tidy

Comments

@VReichelt
Copy link

Bugzilla Link 49330
Resolution FIXED
Resolved on Feb 27, 2021 11:39
Version unspecified
OS Linux
CC @steveire

Extended Description

Running clang-tidy with -checks='-*,bugprone-virtual-near-miss' on the following valid source code triggers an assertion:

========================================================
template <template class T> struct A : T<0>
{
void foo();
};

This is a recent regression between revision 9f58181 and ba1d954.

clang-tidy: /llvm-project/llvm/include/llvm/Support/Casting.h:104: static bool llvm::isa_impl_cl<To, const From*>::doit(const From*) [with To = clang::CXXRecordDecl; From = clang::NamedDecl]: Assertion `Val && "isa<> used on a null pointer"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0. Program arguments: /LLVM-trunk/bin/clang-tidy -checks=-*,bugprone-virtual-near-miss CTbug.cc --

  1. parser at end of file
    #​0 0x000000000273143c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/LLVM-trunk/bin/clang-tidy+0x273143c)
    #​1 0x000000000272f294 llvm::sys::RunSignalHandlers() (/LLVM-trunk/bin/clang-tidy+0x272f294)
    #​2 0x000000000272f3f3 SignalHandler(int) Signals.cpp:0:0
    #​3 0x00007f990aa7c680 __restore_rt sigaction.c:0:0
    #​4 0x00007f9909817207 raise (/lib64/libc.so.6+0x36207)
    #​5 0x00007f99098188f8 abort (/lib64/libc.so.6+0x378f8)
    #​6 0x00007f9909810026 __assert_fail_base (/lib64/libc.so.6+0x2f026)
    #​7 0x00007f99098100d2 (/lib64/libc.so.6+0x2f0d2)
    #​8 0x000000000059e5cd clang::tidy::bugprone::VirtualNearMissCheck::check(clang::ast_matchers::MatchFinder::MatchResult const&) (/LLVM-trunk/bin/clang-tidy+0x59e5cd)
    #​9 0x0000000002040de1 clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::MatchVisitor::visitMatch(clang::ast_matchers::BoundNodes const&) ASTMatchFinder.cpp:0:0
    #​10 0x00000000020804e7 clang::ast_matchers::internal::BoundNodesTreeBuilder::visitMatches(clang::ast_matchers::internal::BoundNodesTreeBuilder::Visitor*) (/LLVM-trunk/bin/clang-tidy+0x20804e7)
    #​11 0x0000000002042adb clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::matchWithFilter(clang::DynTypedNode const&) ASTMatchFinder.cpp:0:0
    #​12 0x0000000002063b7b clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::TraverseDecl(clang::Decl*) ASTMatchFinder.cpp:0:0
    #​13 0x00000000020642aa clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseDeclContextHelper(clang::DeclContext*) (.part.7214) ASTMatchFinder.cpp:0:0
    #​14 0x0000000002062b5c clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseDecl(clang::Decl*) ASTMatchFinder.cpp:0:0
    #​15 0x0000000002063b86 clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::TraverseDecl(clang::Decl*) ASTMatchFinder.cpp:0:0
    #​16 0x0000000002079c3d clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseClassTemplateDecl(clang::ClassTemplateDecl*) ASTMatchFinder.cpp:0:0
    #​17 0x0000000002063b86 clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::TraverseDecl(clang::Decl*) ASTMatchFinder.cpp:0:0
    #​18 0x00000000020642aa clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseDeclContextHelper(clang::DeclContext*) (.part.7214) ASTMatchFinder.cpp:0:0
    #​19 0x0000000002062ce4 clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseDecl(clang::Decl*) ASTMatchFinder.cpp:0:0
    #​20 0x0000000002063b86 clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::TraverseDecl(clang::Decl*) ASTMatchFinder.cpp:0:0
    #​21 0x0000000002063e45 clang::ast_matchers::MatchFinder::matchAST(clang::ASTContext&) (/LLVM-trunk/bin/clang-tidy+0x2063e45)
    #​22 0x00000000013f1428 clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&) (/LLVM-trunk/bin/clang-tidy+0x13f1428)
    #​23 0x0000000001589849 clang::ParseAST(clang::Sema&, bool, bool) (/LLVM-trunk/bin/clang-tidy+0x1589849)
    #​24 0x00000000013d5c41 clang::FrontendAction::Execute() (/LLVM-trunk/bin/clang-tidy+0x13d5c41)
    #​25 0x0000000001367dd1 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/LLVM-trunk/bin/clang-tidy+0x1367dd1)
    #​26 0x0000000000d362be clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptrclang::CompilerInvocation, clang::FileManager*, std::shared_ptrclang::PCHContainerOperations, clang::DiagnosticConsumer*) (/LLVM-trunk/bin/clang-tidy+0xd362be)
    #​27 0x0000000000cea630 clang::tidy::runClangTidy(clang::tidy::ClangTidyContext&, clang::tooling::CompilationDatabase const&, llvm::ArrayRef<std::__cxx11::basic_string<char, std::char_traits, std::allocator > >, llvm::IntrusiveRefCntPtrllvm::vfs::OverlayFileSystem, bool, llvm::StringRef)::ActionFactory::runInvocation(std::shared_ptrclang::CompilerInvocation, clang::FileManager*, std::shared_ptrclang::PCHContainerOperations, clang::DiagnosticConsumer*) ClangTidy.cpp:0:0
    #​28 0x0000000000d2e444 clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptrclang::CompilerInvocation, std::shared_ptrclang::PCHContainerOperations) (/LLVM-trunk/bin/clang-tidy+0xd2e444)
    #​29 0x0000000000d32d4d clang::tooling::ToolInvocation::run() (/LLVM-trunk/bin/clang-tidy+0xd32d4d)
    #​30 0x0000000000d35488 clang::tooling::ClangTool::run(clang::tooling::ToolAction*) (/LLVM-trunk/bin/clang-tidy+0xd35488)
    #​31 0x0000000000cf1a2e clang::tidy::runClangTidy(clang::tidy::ClangTidyContext&, clang::tooling::CompilationDatabase const&, llvm::ArrayRef<std::__cxx11::basic_string<char, std::char_traits, std::allocator > >, llvm::IntrusiveRefCntPtrllvm::vfs::OverlayFileSystem, bool, llvm::StringRef) (/LLVM-trunk/bin/clang-tidy+0xcf1a2e)
@llvmbot
Copy link
Collaborator

llvmbot commented Feb 23, 2021

Likely introduced in 9a4b574, Author has been made aware

@llvmbot
Copy link
Collaborator

llvmbot commented Feb 27, 2021

*** Bug llvm/llvm-bugzilla-archive#49370 has been marked as a duplicate of this bug. ***

@steveire
Copy link
Collaborator

Thanks, reverted the offending commit.

@llvmbot
Copy link
Collaborator

llvmbot commented Nov 27, 2021

mentioned in issue llvm/llvm-bugzilla-archive#49370

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 11, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang-tidy
Projects
None yet
Development

No branches or pull requests

3 participants