https://bugs.llvm.org/show_bug.cgi?id=41588

            Bug ID: 41588
           Summary: Assertion failure:
                    StaticAnalyzer/Core/RangeConstraintManager.cpp:63:
                    const llvm::APSInt
                    &clang::ento::RangeSet::getMinValue() const: Assertion
                    `!isEmp ty()' failed.
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: dcough...@apple.com
          Reporter: griboz...@gmail.com
                CC: dcough...@apple.com, llvm-bugs@lists.llvm.org

At SVN r359128:

$ cat /tmp/t.cc
struct Length {
  unsigned value;
};
Length getLength();

bool condition() {
  Length x = getLength();
  Length y = getLength();
  int diff = x.value - y.value;
  if (diff != 0)
    ;
  if (y.value - x.value != 0)
    ;
  return diff;
}

void entry() {
  if (condition())
    ;
}
$ ./bin/clang-tidy -checks="-*,clang-analyzer*" /tmp/t.cc
Error while trying to load a compilation database:
Could not auto-detect compilation database for file "/tmp/t.cc"
No compilation database found in /tmp or any parent directory
fixed-compilation-database: Error while opening fixed database: No such file or
directory
json-compilation-database: Error while opening JSON database: No such file or
directory
Running without flags.
clang-tidy:
llvm-project/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:63: const
llvm::APSInt &clang::ento::RangeSet::getMinValue() const: Assertion
`!isEmpty()' failed.
 #0 0x000000000067ee54 PrintStackTraceSignalHandler(void*)
(./bin/clang-tidy+0x67ee54)
 #1 0x000000000067cbec llvm::sys::RunSignalHandlers()
(./bin/clang-tidy+0x67cbec)
 #2 0x000000000067f398 SignalHandler(int) (./bin/clang-tidy+0x67f398)
 #3 0x00007f555d49e0c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x110c0)
 #4 0x00007f555c028fcf raise (/lib/x86_64-linux-gnu/libc.so.6+0x32fcf)
 #5 0x00007f555c02a3fa abort (/lib/x86_64-linux-gnu/libc.so.6+0x343fa)
 #6 0x00007f555c021e37 (/lib/x86_64-linux-gnu/libc.so.6+0x2be37)
 #7 0x00007f555c021ee2 (/lib/x86_64-linux-gnu/libc.so.6+0x2bee2)
 #8 0x0000000000ddd334 clang::ento::RangeSet::getMinValue() const
(./bin/clang-tidy+0xddd334)
 #9 0x0000000000ddd379 clang::ento::RangeSet::pin(llvm::APSInt&, llvm::APSInt&)
const (./bin/clang-tidy+0xddd379)
#10 0x0000000000ddd792
clang::ento::RangeSet::Intersect(clang::ento::BasicValueFactory&,
llvm::ImmutableSet<clang::ento::Range, clang::ento::RangeTrait>::Factory&,
llvm::APSInt, llvm::APSInt) const (./bin/clang-tidy+0xddd792)
#11 0x0000000000de19d2 (anonymous
namespace)::RangeConstraintManager::assumeSymNE(llvm::IntrusiveRefCntPtr<clang::ento::ProgramState
const>, clang::ento::SymExpr const*, llvm::APSInt const&, llvm::APSInt const&)
(./bin/clang-tidy+0xde19d2)
#12 0x0000000000de60e3
clang::ento::RangedConstraintManager::assumeSymRel(llvm::IntrusiveRefCntPtr<clang::ento::ProgramState
const>, clang::ento::SymExpr const*, clang::BinaryOperatorKind, llvm::APSInt
const&) (./bin/clang-tidy+0xde60e3)
#13 0x0000000000de562a
clang::ento::RangedConstraintManager::assumeSym(llvm::IntrusiveRefCntPtr<clang::ento::ProgramState
const>, clang::ento::SymExpr const*, bool) (./bin/clang-tidy+0xde562a)
#14 0x0000000000e0128c
clang::ento::SimpleConstraintManager::assumeAux(llvm::IntrusiveRefCntPtr<clang::ento::ProgramState
const>, clang::ento::NonLoc, bool) (./bin/clang-tidy+0xe0128c)
#15 0x0000000000e00ff8
clang::ento::SimpleConstraintManager::assume(llvm::IntrusiveRefCntPtr<clang::ento::ProgramState
const>, clang::ento::NonLoc, bool) (./bin/clang-tidy+0xe00ff8)
#16 0x0000000000e00f0b
clang::ento::SimpleConstraintManager::assume(llvm::IntrusiveRefCntPtr<clang::ento::ProgramState
const>, clang::ento::DefinedSVal, bool) (./bin/clang-tidy+0xe00f0b)
#17 0x0000000000b457fc
clang::ento::ConstraintManager::assumeDual(llvm::IntrusiveRefCntPtr<clang::ento::ProgramState
const>, clang::ento::DefinedSVal) (./bin/clang-tidy+0xb457fc)
#18 0x0000000000d8c92e clang::ento::ExprEngine::processBranch(clang::Stmt
const*, clang::ento::NodeBuilderContext&, clang::ento::ExplodedNode*,
clang::ento::ExplodedNodeSet&, clang::CFGBlock const*, clang::CFGBlock const*)
(./bin/clang-tidy+0xd8c92e)
#19 0x0000000000d76152 clang::ento::CoreEngine::HandleBranch(clang::Stmt
const*, clang::Stmt const*, clang::CFGBlock const*, clang::ento::ExplodedNode*)
(./bin/clang-tidy+0xd76152)
#20 0x0000000000d7493b
clang::ento::CoreEngine::ExecuteWorkList(clang::LocationContext const*,
unsigned int, llvm::IntrusiveRefCntPtr<clang::ento::ProgramState const>)
(./bin/clang-tidy+0xd7493b)
#21 0x0000000000b1b807 (anonymous
namespace)::AnalysisConsumer::HandleCode(clang::Decl*, unsigned int,
clang::ento::ExprEngine::InliningModes, llvm::DenseSet<clang::Decl const*,
llvm::DenseMapInfo<clang::Decl const*> >*) (./bin/clang-tidy+0xb1b807)
#22 0x0000000000b14385 (anonymous
namespace)::AnalysisConsumer::HandleTranslationUnit(clang::ASTContext&)
(./bin/clang-tidy+0xb14385)
#23 0x0000000000f0423c
clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&)
(./bin/clang-tidy+0xf0423c)
#24 0x000000000105db03 clang::ParseAST(clang::Sema&, bool, bool)
(./bin/clang-tidy+0x105db03)
#25 0x0000000000eec2e0 clang::FrontendAction::Execute()
(./bin/clang-tidy+0xeec2e0)
#26 0x0000000000e91161
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(./bin/clang-tidy+0xe91161)
#27 0x00000000009fda36
clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>,
clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>,
clang::DiagnosticConsumer*) (./bin/clang-tidy+0x9fda36)
#28 0x0000000000689125
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, l
lvm::StringRef)::ActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>,
clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>,
clang::DiagnosticConsumer*) (./bin/clang-tidy+0x689125)
#29 0x00000000009fd7a6 clang::tooling::ToolInvocation::runInvocation(char
const*, clang::driver::Compilation*,
std::shared_ptr<clang::CompilerInvocation>,
std::shared_ptr<clang::PCHContainerOperations>) (./bin/clang-tidy+0x9fd7a6)
#30 0x00000000009fd057 clang::tooling::ToolInvocation::run()
(./bin/clang-tidy+0x9fd057)
#31 0x00000000009feede
clang::tooling::ClangTool::run(clang::tooling::ToolAction*)
(./bin/clang-tidy+0x9feede)
#32 0x0000000000685a13
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, l
lvm::StringRef) (./bin/clang-tidy+0x685a13)
#33 0x00000000004315cd clang::tidy::clangTidyMain(int, char const**)
(./bin/clang-tidy+0x4315cd)
#34 0x00007f555c0162b1 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x202b1)
#35 0x000000000042f6aa _start (./bin/clang-tidy+0x42f6aa)
Aborted

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to