New Defects reported by Coverity Scan for llvm

Hi,

Please find the latest report on new defect(s) introduced to llvm found with Coverity Scan.

6 new defect(s) introduced to llvm found with Coverity Scan.
4 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 6 of 6 defect(s)

** CID 1506346: Uninitialized members (UNINIT_CTOR)
/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h: 186 in clang::ento::CallEvent::CallEvent(const clang::Decl *, llvm::IntrusiveRefCntPtr, const clang::LocationContext *, clang::CFGBlock::ElementRefImpl<(bool)1>)()


*** CID 1506346: Uninitialized members (UNINIT_CTOR)
/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h: 186 in clang::ento::CallEvent::CallEvent(const clang::Decl *, llvm::IntrusiveRefCntPtr, const clang::LocationContext *, clang::CFGBlock::ElementRefImpl<(bool)1>)()
180 CallEvent(const Expr *E, ProgramStateRef state, const LocationContext *lctx,
181 CFGBlock::ConstCFGElementRef ElemRef)
182 : State(std::move(state)), LCtx(lctx), Origin(E), ElemRef(ElemRef) {}
183
184 CallEvent(const Decl *D, ProgramStateRef state, const LocationContext *lctx,
185 CFGBlock::ConstCFGElementRef ElemRef)

CID 1506346:  Uninitialized members  (UNINIT_CTOR)
Non-static class member "Data" is not initialized in this constructor nor in any functions that it calls.

186 : State(std::move(state)), LCtx(lctx), Origin(D), ElemRef(ElemRef) {}
187
188 // DO NOT MAKE PUBLIC
189 CallEvent(const CallEvent &Original)
190 : State(Original.State), LCtx(Original.LCtx), Origin(Original.Origin),
191 ElemRef(Original.ElemRef), Data(Original.Data),

** CID 1506345: Performance inefficiencies (AUTO_CAUSES_COPY)
/llvm/lib/Support/FloatingPointMode.cpp: 82 in llvm::operator <<(llvm::raw_ostream &, llvm::FPClassTest)()


*** CID 1506345: Performance inefficiencies (AUTO_CAUSES_COPY)
/llvm/lib/Support/FloatingPointMode.cpp: 82 in llvm::operator <<(llvm::raw_ostream &, llvm::FPClassTest)()
76 if (Mask == fcNone) {
77 OS << “none)”;
78 return OS;
79 }
80
81 ListSeparator LS(" ");

CID 1506345:  Performance inefficiencies  (AUTO_CAUSES_COPY)
Using the "auto" keyword without an "&" causes the copy of an object of type pair.

82 for (auto [BitTest, Name] : NoFPClassName) {
83 if ((Mask & BitTest) == BitTest) {
84 OS << LS << Name;
85
86 // Clear the bits so we don’t print any aliased names later.
87 Mask &= ~BitTest;

** CID 1506344: Uninitialized members (UNINIT_CTOR)
/llvm/tools/llvm-cov/CodeCoverage.cpp: 189 in ::CodeCoverageTool::CodeCoverageTool()()


*** CID 1506344: Uninitialized members (UNINIT_CTOR)
/llvm/tools/llvm-cov/CodeCoverage.cpp: 189 in ::CodeCoverageTool::CodeCoverageTool()()
183
184 /// Allowlist from -name-allowlist to be used for filtering.
185 std::unique_ptr NameAllowlist;
186
187 std::unique_ptrobject::BuildIDFetcher BIDFetcher;
188

CID 1506344:  Uninitialized members  (UNINIT_CTOR)
The compiler-generated constructor for this class does not initialize "CheckBinaryIDs".

189 bool CheckBinaryIDs;
190 };
191 }
192
193 static std::string getErrorString(const Twine &Message, StringRef Whence,
194 bool Warning) {

** CID 1506343: API usage errors (INVALIDATE_ITERATOR)
/bolt/lib/Profile/DataAggregator.cpp: 713 in llvm::bolt::DataAggregator::doSample(llvm::bolt::BinaryFunction &, unsigned long, unsigned long)()


*** CID 1506343: API usage errors (INVALIDATE_ITERATOR)
/bolt/lib/Profile/DataAggregator.cpp: 713 in llvm::bolt::DataAggregator::doSample(llvm::bolt::BinaryFunction &, unsigned long, unsigned long)()
707 }
708
709 Address -= Func.getAddress();
710 if (BAT)
711 Address = BAT->translate(Func.getAddress(), Address, /IsBranchSrc=/false);
712

CID 1506343:  API usage errors  (INVALIDATE_ITERATOR)
Dereferencing iterator "I" though it is already past the end of its container.

713 I->second.bumpCount(Address, Count);
714 return true;
715 }
716
717 bool DataAggregator::doIntraBranch(BinaryFunction &Func, uint64_t From,
718 uint64_t To, uint64_t Count,

** CID 1506342: Uninitialized members (UNINIT_CTOR)
/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h: 182 in clang::ento::CallEvent::CallEvent(const clang::Expr *, llvm::IntrusiveRefCntPtr, const clang::LocationContext *, clang::CFGBlock::ElementRefImpl<(bool)1>)()


*** CID 1506342: Uninitialized members (UNINIT_CTOR)
/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h: 182 in clang::ento::CallEvent::CallEvent(const clang::Expr *, llvm::IntrusiveRefCntPtr, const clang::LocationContext *, clang::CFGBlock::ElementRefImpl<(bool)1>)()
176
177 protected:
178 friend class CallEventManager;
179
180 CallEvent(const Expr *E, ProgramStateRef state, const LocationContext *lctx,
181 CFGBlock::ConstCFGElementRef ElemRef)

CID 1506342:  Uninitialized members  (UNINIT_CTOR)
Non-static class member "Data" is not initialized in this constructor nor in any functions that it calls.

182 : State(std::move(state)), LCtx(lctx), Origin(E), ElemRef(ElemRef) {}
183
184 CallEvent(const Decl *D, ProgramStateRef state, const LocationContext *lctx,
185 CFGBlock::ConstCFGElementRef ElemRef)
186 : State(std::move(state)), LCtx(lctx), Origin(D), ElemRef(ElemRef) {}
187

** CID 1506341: Null pointer dereferences (REVERSE_INULL)
/lldb/source/API/SBAttachInfo.cpp: 303 in lldb::SBAttachInfo::SetScriptedProcessDictionary(lldb::SBStructuredData)()


*** CID 1506341: Null pointer dereferences (REVERSE_INULL)
/lldb/source/API/SBAttachInfo.cpp: 303 in lldb::SBAttachInfo::SetScriptedProcessDictionary(lldb::SBStructuredData)()
297 return data;
298 }
299
300 void SBAttachInfo::SetScriptedProcessDictionary(lldb::SBStructuredData dict) {
301 LLDB_INSTRUMENT_VA(this, dict);
302

CID 1506341:  Null pointer dereferences  (REVERSE_INULL)
Null-checking "dict.m_impl_up" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.

303 if (!dict.IsValid() || !dict.m_impl_up)
304 return;
305
306 StructuredData::ObjectSP obj_sp = dict.m_impl_up->GetObjectSP();
307
308 if (!obj_sp)


To view the defects in Coverity Scan visit, Coverity Scan - Sign in