LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 38072 - Assertion failure in clang::ento::ExprEngine::elideDestructor
Summary: Assertion failure in clang::ento::ExprEngine::elideDestructor
Status: RESOLVED FIXED
Alias: None
Product: clang
Classification: Unclassified
Component: Static Analyzer (show other bugs)
Version: unspecified
Hardware: PC Linux
: P enhancement
Assignee: Artem Dergachev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-05 08:12 PDT by Alexander Kornienko
Modified: 2018-08-01 07:12 PDT (History)
3 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Kornienko 2018-07-05 08:12:51 PDT
$ cat test-ento__ExprEngine__elideDestructor.cc
struct a {
  ~a();
};
struct F {
  a d;
  F(char *, a = a());
};
void g() {
  char h[1];
  for (int i = 0;;) F j(i ? j : h);
}
$ ./clang-tidy -checks=-*,clang-analyzer* test-ento__ExprEngine__elideDestructor.cc -- -std=c++11 
assert.h assertion failed at llvm/tools/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp:485 in static clang::ento::ProgramStateRef clang::ento::ExprEngine::elideDestructor(clang::ento::ProgramStateRef, const clang::CXXBindTemporaryExpr *, const clang::LocationContext *): !State->contains<ElidedDestructors>(I)
    @     0x559134e889d6  __assert_fail
    @     0x559132b8a025  clang::ento::ExprEngine::elideDestructor()
    @     0x559132bb9722  clang::ento::ExprEngine::prepareForObjectConstruction()
    @     0x559132bb962d  clang::ento::ExprEngine::prepareForObjectConstruction()
    @     0x559132bb962d  clang::ento::ExprEngine::prepareForObjectConstruction()
    @     0x559132bba6eb  clang::ento::ExprEngine::VisitCXXConstructExpr()
    @     0x559132b8e30d  clang::ento::ExprEngine::Visit()
    @     0x559132b8b52e  clang::ento::ExprEngine::ProcessStmt()
    @     0x559132b8b24b  clang::ento::ExprEngine::processCFGElement()
    @     0x559132bac965  clang::ento::CoreEngine::HandlePostStmt()
    @     0x559132babdbd  clang::ento::CoreEngine::ExecuteWorkList()
    @     0x5591328dbc66  (anonymous namespace)::AnalysisConsumer::ActionExprEngine()
    @     0x5591328db7e6  (anonymous namespace)::AnalysisConsumer::HandleCode()
    @     0x5591328c73b4  (anonymous namespace)::AnalysisConsumer::HandleTranslationUnit()

This is most likely caused by r335800.
Comment 1 Artem Dergachev 2018-07-11 18:26:26 PDT
Yup, thanks! Default arguments strike back. https://reviews.llvm.org/D49213
Comment 2 Alexander Kornienko 2018-08-01 07:12:46 PDT
The fix was committed in r338441.