-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillaclang-tidycompile-failUse [accepts-invalid] and [rejects-valid] insteadUse [accepts-invalid] and [rejects-valid] insteadregression
Description
| Bugzilla Link | 44894 |
| Resolution | FIXED |
| Resolved on | Feb 17, 2020 04:04 |
| Version | unspecified |
| OS | Linux |
| Blocks | #44161 |
| CC | @EugeneZelenko,@zmodem |
| Fixed by commit(s) | rG8c4cf23dee1ac3f259c4795b275cc9bb1234aa29 |
Extended Description
The following valid code snippet triggers an assertion in clang-tidy with
-checks='-*,bugprone-infinite-loop' :
=====================================
template void foo()
{
for (int i = 0; i < N; ++i)
;
}
This is a recent regression introduced on trunk between commits c290038 (OK) and 6646f31 (broken).
clang-tidy: /LLVM/llvm-project/clang/lib/AST/ExprConstant.cpp:13793: bool clang::Expr::EvaluateAsBooleanCondition(bool&, const clang::ASTContext&, bool) const: Assertion `!isValueDependent() && "Expression evaluator can't be called on a dependent expression."' failed.
Stack dump:
0. Program arguments: /LLVM-trunk/bin/clang-tidy -checks=-*,bugprone-infinite-loop CTbug.cc --
- parser at end of file
#9 0x00000000004ccd86 clang::tidy::bugprone::InfiniteLoopCheck::check(clang::ast_matchers::MatchFinder::MatchResult const&) (/LLVM-trunk/bin/clang-tidy+0x4ccd86)
#10 0x0000000001cd5ef8 clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::MatchVisitor::visitMatch(clang::ast_matchers::BoundNodes const&) (/LLVM-trunk/bin/clang-tidy+0x1cd5ef8)
#11 0x0000000001d12747 clang::ast_matchers::internal::BoundNodesTreeBuilder::visitMatches(clang::ast_matchers::internal::BoundNodesTreeBuilder::Visitor*) (/LLVM-trunk/bin/clang-tidy+0x1d12747)
#12 0x0000000001cd7599 clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::matchWithFilter(clang::ast_type_traits::DynTypedNode const&) (/LLVM-trunk/bin/clang-tidy+0x1cd7599)
#13 0x0000000001cf900c clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::TraverseStmt(clang::Stmt*, llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool, llvm::PointerLikeTypeTraitsclang::Stmt*, llvm::PointerIntPairInfo<clang::Stmt*, 1u, llvm::PointerLikeTypeTraitsclang::Stmt* > > >) (.part.6699) (/LLVM-trunk/bin/clang-tidy+0x1cf900c)
#14 0x0000000001cf99bd clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseCompoundStmt(clang::CompoundStmt, llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool, llvm::PointerLikeTypeTraitsclang::Stmt*, llvm::PointerIntPairInfo<clang::Stmt*, 1u, llvm::PointerLikeTypeTraitsclang::Stmt* > > >) (/LLVM-trunk/bin/clang-tidy+0x1cf99bd)
#15 0x0000000001cf6b95 clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseStmt(clang::Stmt, llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool, llvm::PointerLikeTypeTraitsclang::Stmt*, llvm::PointerIntPairInfo<clang::Stmt*, 1u, llvm::PointerLikeTypeTraitsclang::Stmt* > > >) (/LLVM-trunk/bin/clang-tidy+0x1cf6b95)
#16 0x0000000001cffca4 clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::TraverseStmt(clang::Stmt, llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool, llvm::PointerLikeTypeTraitsclang::Stmt*, llvm::PointerIntPairInfo<clang::Stmt*, 1u, llvm::PointerLikeTypeTraitsclang::Stmt* > > >) (.part.6699.constprop.6742) (/LLVM-trunk/bin/clang-tidy+0x1cffca4)
#17 0x0000000001d0ebd5 clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseFunctionHelper(clang::FunctionDecl) (/LLVM-trunk/bin/clang-tidy+0x1d0ebd5)
#18 0x0000000001cf4b83 clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::TraverseDecl(clang::Decl*) (.part.6695) (/LLVM-trunk/bin/clang-tidy+0x1cf4b83)
#19 0x0000000001d0dfba clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseFunctionTemplateDecl(clang::FunctionTemplateDecl*) (/LLVM-trunk/bin/clang-tidy+0x1d0dfba)
#20 0x0000000001cf544b clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::TraverseDecl(clang::Decl*) (.part.6695) (/LLVM-trunk/bin/clang-tidy+0x1cf544b)
#21 0x0000000001cf634a clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseDeclContextHelper(clang::DeclContext*) (.part.6696) (/LLVM-trunk/bin/clang-tidy+0x1cf634a)
#22 0x0000000001cf52e4 clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::TraverseDecl(clang::Decl*) (.part.6695) (/LLVM-trunk/bin/clang-tidy+0x1cf52e4)
#23 0x0000000001cf5ed1 clang::ast_matchers::MatchFinder::matchAST(clang::ASTContext&) (/LLVM-trunk/bin/clang-tidy+0x1cf5ed1)
#24 0x00000000011b2198 clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&) (/LLVM-trunk/bin/clang-tidy+0x11b2198)
#25 0x0000000001320b59 clang::ParseAST(clang::Sema&, bool, bool) (/LLVM-trunk/bin/clang-tidy+0x1320b59)
#26 0x0000000001194d29 clang::FrontendAction::Execute() (/LLVM-trunk/bin/clang-tidy+0x1194d29)
#27 0x00000000011532b2 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/LLVM-trunk/bin/clang-tidy+0x11532b2)
#28 0x0000000000c213ce clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptrclang::CompilerInvocation, clang::FileManager*, std::shared_ptrclang::PCHContainerOperations, clang::DiagnosticConsumer*) (/LLVM-trunk/bin/clang-tidy+0xc213ce)
#29 0x0000000000bdc1c5 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*) (/LLVM-trunk/bin/clang-tidy+0xbdc1c5)
#30 0x0000000000c19664 clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptrclang::CompilerInvocation, std::shared_ptrclang::PCHContainerOperations) (/LLVM-trunk/bin/clang-tidy+0xc19664)
#31 0x0000000000c1da6d clang::tooling::ToolInvocation::run() (/LLVM-trunk/bin/clang-tidy+0xc1da6d)
#32 0x0000000000c20498 clang::tooling::ClangTool::run(clang::tooling::ToolAction*) (/LLVM-trunk/bin/clang-tidy+0xc20498)
#33 0x0000000000be41a7 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+0xbe41a7)
#34 0x000000000045a639 clang::tidy::clangTidyMain(int, char const**) (/LLVM-trunk/bin/clang-tidy+0x45a639)
Metadata
Metadata
Assignees
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillaclang-tidycompile-failUse [accepts-invalid] and [rejects-valid] insteadUse [accepts-invalid] and [rejects-valid] insteadregression