Index: lib/StaticAnalyzer/Checkers/MallocChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/MallocChecker.cpp +++ lib/StaticAnalyzer/Checkers/MallocChecker.cpp @@ -1275,7 +1275,11 @@ return nullptr; SymbolRef Sym = retVal.getAsLocSymbol(); - assert(Sym); + + // Special case when the 'c++-allocator-inlining' config option sets true and + // the c++ allocator return a Null pointer. + if (!Sym) + return nullptr; // Set the symbol's state to Allocated. return State->set(Sym, RefState::getAllocated(Family, E)); Index: test/Analysis/inline.cpp =================================================================== --- test/Analysis/inline.cpp +++ test/Analysis/inline.cpp @@ -1,4 +1,5 @@ // RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.Malloc,debug.ExprInspection -analyzer-config ipa=inlining -analyzer-config c++-allocator-inlining=true -verify %s +// RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=core,unix.Malloc,debug.ExprInspection -analyzer-config ipa=inlining -analyzer-config c++-allocator-inlining=true -verify %s void clang_analyzer_eval(bool); void clang_analyzer_checkInlined(bool); @@ -444,3 +445,23 @@ reinterpret_cast(one_argument)(); // expected-warning{{Function taking 1 argument is called with fewer (0)}} } } + +namespace std { + struct nothrow_t {}; + extern const nothrow_t nothrow; +} + +// Operator new, the nothrow version. +void* operator new(size_t size, const std::nothrow_t&) noexcept { + void *p = nullptr; + return p; +} + +namespace bug34144 { + // Don't crash when the 'c++-allocator-inlining' config option sets true and + // the c++ allocator return a Null pointer. + void call_new() { + int *i = new(std::nothrow) int(1); + delete i; + } +}