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

clang-tidy crash bugprone-unchecked-optional-access #56534

Open
stayprivate opened this issue Jul 14, 2022 · 0 comments
Open

clang-tidy crash bugprone-unchecked-optional-access #56534

stayprivate opened this issue Jul 14, 2022 · 0 comments
Labels
clang:tooling LibTooling crash Prefer [crash-on-valid] or [crash-on-invalid]

Comments

@stayprivate
Copy link

stayprivate commented Jul 14, 2022

Hello,

Stack dump of clang-tidy-15 obtain from llvm repos as for july 14 th . Previous version would analyze the file for ever, well at least 8 hours. I was planning on trying to build a simple test case but never get around to it. The file has 4100 lines and the function it seems to crash in is 1500 lines.

$ clang-tidy-15 --version 
Ubuntu LLVM version 15.0.0
  
  Optimized build.
  Default target: x86_64-pc-linux-gnu
  Host CPU: znver1
Stack dump:
0.	Program arguments: clang-tidy-15 -header-filter=/home/private/eclipse-workspace/logc2/optimizers/optib -checks=*,-abseil-*,-altera-*,-android-*,-clang-*,-fuchsia-*,-google-*,-llvmlibc-*,-llvm-*,-mpi-*,-objc-*,-zircon-*,-bugprone-suspicious-include,-bugprone-easily-swappable-parameters,-bugprone-narrowing-conversions,-bugprone-integer-division,-bugprone-incorrect-roundings,-bugprone-branch-clone,-bugprone-signed-char-misuse,-bugprone-implicit-widening-of-multiplication-result,-cert-msc30-c,-cert-msc32-c,-cert-msc50-cpp,-cert-msc51-cpp,-cert-err33-c,-cert-err34-c,-cert-str34-c,-cert-dcl50-cpp,-cert-no-assembler,-cert-env33-c,-cert-err58-cpp,-cert-flp30-c,-concurrency-mt-unsafe,-cppcoreguidelines-non-private-member-variables-in-classes,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-union-access,-cppcoreguidelines-pro-type-vararg,-cppcoreguidelines-avoid-non-const-global-variables,-cppcoreguidelines-init-variables,-cppcoreguidelines-pro-type-cstyle-cast,-cppcoreguidelines-no-malloc,-cppcoreguidelines-macro-usage,-cppcoreguidelines-init-variables,-cppcoreguidelines-owning-memory,-cppcoreguidelines-avoid-c-arrays,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-narrowing-conversions,-cppcoreguidelines-prefer-member-initializer,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-member-init,-cppcoreguidelines-special-member-functions,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-virtual-class-destructor,-hicpp-deprecated-headers,-hicpp-member-init,-hicpp-uppercase-literal-suffix,-hicpp-special-member-functions,-hicpp-vararg,-hicpp-no-assembler,-hicpp-named-parameter,-hicpp-avoid-c-arrays,-hicpp-use-auto,-hicpp-signed-bitwise,-hicpp-no-malloc,-hicpp-explicit-conversions,-hicpp-function-size,-hicpp-no-array-decay,-hicpp-pro-bounds-array-to-pointer-decay,-llvmlibc-restrict-system-libc-headers,-misc-non-private-member-variables-in-classes,-misc-no-recursion,-modernize-use-using,-modernize-macro-to-enum,-modernize-use-nodiscard,-modernize-use-trailing-return-type,-modernize-use-auto,-modernize-loop-convert,-modernize-deprecated-headers,-modernize-avoid-c-arrays,-modernize-use-default-member-init,-performance-no-int-to-ptr,-readability-avoid-const-params-in-decls,-readability-named-parameter,-readability-uppercase-literal-suffix,-readability-isolate-declaration,-readability-static-accessed-through-instance,-readability-else-after-return,-readability-redundant-access-specifiers,-readability-qualified-auto,-readability-use-anyofallof,-readability-container-data-pointer,-readability-identifier-naming,-readability-container-data-pointer,-readability-magic-numbers,-readability-function-size,-readability-function-cognitive-complexity,-readability-identifier-length,-readability-container-data-pointer,-readability-implicit-bool-conversion -p=/home/private/eclipse-workspace/logc2/bin/Z_fastCompile -quiet /home/private/eclipse-workspace/logc2/optimizers/optib/opti.cpp
1.	<eof> parser at end of file
2.	ASTMatcher: Processing 'bugprone-unchecked-optional-access' against:
	FunctionDecl nsOptib::OptiPatron2Faces : </home/private/eclipse-workspace/logc2/optimizers/optib/opti.cpp:190:1, line:1724:1>
--- Bound Nodes Begin ---
    T - { RecordType : nsOptib::SideBoardReduceInfo }
    fun - { FunctionDecl nsOptib::OptiPatron2Faces : </home/private/eclipse-workspace/logc2/optimizers/optib/opti.cpp:190:1, line:1724:1> }
--- Bound Nodes End ---
86584 warnings generated.
 #0 0x00007f4b8e952e21 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-15/bin/../lib/libLLVM-15.so.1+0xefbe21)
 #1 0x00007f4b8e950b7e llvm::sys::RunSignalHandlers() (/usr/lib/llvm-15/bin/../lib/libLLVM-15.so.1+0xef9b7e)
 #2 0x00007f4b8e95334b (/usr/lib/llvm-15/bin/../lib/libLLVM-15.so.1+0xefc34b)
 #3 0x00007f4b983dc420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007f4b967e8cee clang::dataflow::buildBooleanFormula(llvm::DenseSet<clang::dataflow::BoolValue*, llvm::DenseMapInfo<clang::dataflow::BoolValue*, void>> const&) (/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15+0x1e4ccee)
 #5 0x00007f4b967eb224 (/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15+0x1e4f224)
 #6 0x00007f4b967eafa4 clang::dataflow::WatchedLiteralsSolver::solve(llvm::DenseSet<clang::dataflow::BoolValue*, llvm::DenseMapInfo<clang::dataflow::BoolValue*, void>>) (/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15+0x1e4efa4)
 #7 0x00007f4b967db854 clang::dataflow::DataflowAnalysisContext::querySolver(llvm::DenseSet<clang::dataflow::BoolValue*, llvm::DenseMapInfo<clang::dataflow::BoolValue*, void>>) (/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15+0x1e3f854)
 #8 0x00007f4b967dbad0 clang::dataflow::DataflowAnalysisContext::flowConditionImplies(clang::dataflow::AtomicBoolValue&, clang::dataflow::BoolValue&) (/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15+0x1e3fad0)
 #9 0x00007f4b967f5cbd clang::dataflow::UncheckedOptionalAccessModel::merge(clang::QualType, clang::dataflow::Value const&, clang::dataflow::Environment const&, clang::dataflow::Value const&, clang::dataflow::Environment const&, clang::dataflow::Value&, clang::dataflow::Environment&) (/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15+0x1e59cbd)
#10 0x00007f4b967e14a6 clang::dataflow::Environment::join(clang::dataflow::Environment const&, clang::dataflow::Environment::ValueModel&) (/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15+0x1e454a6)
#11 0x00007f4b967e6146 clang::dataflow::transferBlock(clang::dataflow::ControlFlowContext const&, std::vector<llvm::Optional<clang::dataflow::TypeErasedDataflowAnalysisState>, std::allocator<llvm::Optional<clang::dataflow::TypeErasedDataflowAnalysisState>>>&, clang::CFGBlock const&, clang::dataflow::Environment const&, clang::dataflow::TypeErasedDataflowAnalysis&, std::function<void (clang::CFGStmt const&, clang::dataflow::TypeErasedDataflowAnalysisState const&)>) (/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15+0x1e4a146)
#12 0x00007f4b967e6dc3 clang::dataflow::runTypeErasedDataflowAnalysis(clang::dataflow::ControlFlowContext const&, clang::dataflow::TypeErasedDataflowAnalysis&, clang::dataflow::Environment const&, std::function<void (clang::Stmt const*, clang::dataflow::TypeErasedDataflowAnalysisState const&)>) (/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15+0x1e4adc3)
#13 0x000055f92e82f69c llvm::Expected<std::vector<llvm::Optional<clang::dataflow::DataflowAnalysisState<clang::dataflow::UncheckedOptionalAccessModel::Lattice>>, std::allocator<llvm::Optional<clang::dataflow::DataflowAnalysisState<clang::dataflow::UncheckedOptionalAccessModel::Lattice>>>>> clang::dataflow::runDataflowAnalysis<clang::dataflow::UncheckedOptionalAccessModel>(clang::dataflow::ControlFlowContext const&, clang::dataflow::UncheckedOptionalAccessModel&, clang::dataflow::Environment const&, std::function<void (clang::Stmt const*, clang::dataflow::DataflowAnalysisState<clang::dataflow::UncheckedOptionalAccessModel::Lattice> const&)>) (/usr/lib/llvm-15/bin/clang-tidy+0x39b69c)
#14 0x000055f92e82f152 clang::tidy::bugprone::UncheckedOptionalAccessCheck::check(clang::ast_matchers::MatchFinder::MatchResult const&) (/usr/lib/llvm-15/bin/clang-tidy+0x39b152)
#15 0x00007f4b95a843dc (/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15+0x10e83dc)
#16 0x00007f4b95ab7ffc clang::ast_matchers::internal::BoundNodesTreeBuilder::visitMatches(clang::ast_matchers::internal::BoundNodesTreeBuilder::Visitor*) (/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15+0x111bffc)
#17 0x00007f4b95a83e0e (/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15+0x10e7e0e)
#18 0x00007f4b95a86a1f (/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15+0x10eaa1f)
#19 0x00007f4b95a8898b (/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15+0x10ec98b)
#20 0x00007f4b95a86b76 (/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15+0x10eab76)
#21 0x00007f4b95a8f29b (/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15+0x10f329b)
#22 0x00007f4b95a86a57 (/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15+0x10eaa57)
#23 0x00007f4b95a56721 clang::ast_matchers::MatchFinder::matchAST(clang::ASTContext&) (/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15+0x10ba721)
#24 0x00007f4b9705eb2c clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&) (/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15+0x26c2b2c)
#25 0x00007f4b9540cb04 clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15+0xa70b04)
#26 0x00007f4b97021297 clang::FrontendAction::Execute() (/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15+0x2685297)
#27 0x00007f4b96f96136 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15+0x25fa136)
#28 0x00007f4b9724961c clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) (/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15+0x28ad61c)
#29 0x000055f92ecb255d (/usr/lib/llvm-15/bin/clang-tidy+0x81e55d)
#30 0x00007f4b9724937f clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptr<clang::CompilerInvocation>, std::shared_ptr<clang::PCHContainerOperations>) (/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15+0x28ad37f)
#31 0x00007f4b97248405 clang::tooling::ToolInvocation::run() (/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15+0x28ac405)
#32 0x00007f4b9724ae0e clang::tooling::ClangTool::run(clang::tooling::ToolAction*) (/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15+0x28aee0e)
#33 0x000055f92ecad77d clang::tidy::runClangTidy(clang::tidy::ClangTidyContext&, clang::tooling::CompilationDatabase const&, llvm::ArrayRef<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem>, bool, bool, llvm::StringRef) (/usr/lib/llvm-15/bin/clang-tidy+0x81977d)
#34 0x000055f92e6a2861 clang::tidy::clangTidyMain(int, char const**) (/usr/lib/llvm-15/bin/clang-tidy+0x20e861)
#35 0x00007f4b8d503083 __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:342:3
#36 0x000055f92e69d6be _start (/usr/lib/llvm-15/bin/clang-tidy+0x2096be)
@EugeneZelenko EugeneZelenko added clang:tooling LibTooling crash Prefer [crash-on-valid] or [crash-on-invalid] and removed new issue labels Jul 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:tooling LibTooling crash Prefer [crash-on-valid] or [crash-on-invalid]
Projects
None yet
Development

No branches or pull requests

2 participants