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.

5 new defect(s) introduced to llvm found with Coverity Scan.
5 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 5 of 5 defect(s)

** CID 1506428: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp: 743 in isContiguousLoadIdx(mlir::linalg::LinalgOp &, mlir::Value &, bool &)()


*** CID 1506428: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp: 743 in isContiguousLoadIdx(mlir::linalg::LinalgOp &, mlir::Value &, bool &)()
737 // than 1.
738 if (!isa<arith::AddIOp, arith::SubIOp, arith::ConstantOp, linalg::IndexOp>(
739 ancestor))
740 return false;
741
742 bool result = false;

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

743 for (auto op : ancestor->getOperands())
744 result |= isContiguousLoadIdx(linalgOp, op, foundIndexOp);
745
746 return result;
747 }
748

** CID 1506427: Uninitialized members (UNINIT_CTOR)
/lldb/source/Core/Debugger.cpp: 865 in lldb_private::Debugger::Debugger(void (*)(const char *, void *), void *)()


*** CID 1506427: Uninitialized members (UNINIT_CTOR)
/lldb/source/Core/Debugger.cpp: 865 in lldb_private::Debugger::Debugger(void (*)(const char *, void *), void *)()
859
860 #if defined(_WIN32) && defined(ENABLE_VIRTUAL_TERMINAL_PROCESSING)
861 // Enabling use of ANSI color codes because LLDB is using them to highlight
862 // text.
863 llvm::sys::Process::UseANSIEscapeCodes(true);
864 #endif

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

865 }
866
867 Debugger::~Debugger() { Clear(); }
868
869 void Debugger::Clear() {
870 // Make sure we call this function only once. With the C++ global destructor

** CID 1506426: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp: 679 in isLoopInvariantIdx(mlir::linalg::LinalgOp &, mlir::Value &)()


*** CID 1506426: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp: 679 in isLoopInvariantIdx(mlir::linalg::LinalgOp &, mlir::Value &)()
673
674 // Values defined inside linalgOp, which are constant, are loop invariant.
675 if (isaarith::ConstantOp(ancestor))
676 return true;
677
678 bool result = true;

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

679 for (auto op : ancestor->getOperands())
680 result &= isLoopInvariantIdx(linalgOp, op);
681
682 return result;
683 }
684

** CID 1506425: Integer handling issues (OVERFLOW_BEFORE_WIDEN)
/clang/lib/AST/ASTContext.cpp: 9561 in getSVETypeSize(clang::ASTContext &, const clang::BuiltinType *)()


*** CID 1506425: Integer handling issues (OVERFLOW_BEFORE_WIDEN)
/clang/lib/AST/ASTContext.cpp: 9561 in getSVETypeSize(clang::ASTContext &, const clang::BuiltinType *)()
9555 /// getSVETypeSize - Return SVE vector or predicate register size.
9556 static uint64_t getSVETypeSize(ASTContext &Context, const BuiltinType *Ty) {
9557 assert(Ty->isVLSTBuiltinType() && “Invalid SVE Type”);
9558 if (Ty->getKind() == BuiltinType::SveBool ||
9559 Ty->getKind() == BuiltinType::SveCount)
9560 return (Context.getLangOpts().VScaleMin * 128) / Context.getCharWidth();

CID 1506425:  Integer handling issues  (OVERFLOW_BEFORE_WIDEN)
Potentially overflowing expression "Context->getLangOpts().VScaleMin * 128U" with type "unsigned int" (32 bits, unsigned) is evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type "uint64_t" (64 bits, unsigned).

9561 return Context.getLangOpts().VScaleMin * 128;
9562 }
9563
9564 bool ASTContext::areCompatibleSveTypes(QualType FirstType,
9565 QualType SecondType) {
9566 assert(

** CID 1506424: Null pointer dereferences (NULL_RETURNS)


*** CID 1506424: Null pointer dereferences (NULL_RETURNS)
/lld/MachO/InputFiles.cpp: 1167 in lld::macho::ObjFile::registerCompactUnwind(lld::macho::Section &)()
1161 }
1162 // Unwind info lives in __DATA, and finalization of __TEXT will occur
1163 // before finalization of __DATA. Moreover, the finalization of unwind
1164 // info depends on the exact addresses that it references. So it is safe
1165 // for compact unwind to reference addresses in __TEXT, but not addresses
1166 // in any other segment.

CID 1506424:  Null pointer dereferences  (NULL_RETURNS)
Dereferencing a pointer that might be "nullptr" "referentIsec" when calling "getSegName".

1167 if (referentIsec->getSegName() != segment_names::text)
1168 error(isec->getLocation(r.offset) + " references section " +
1169 referentIsec->getName() + " which is not in segment __TEXT");
1170 // The functionAddress relocations are typically section relocations.
1171 // However, unwind info operates on a per-symbol basis, so we search for
1172 // the function symbol here.


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