Hi,
Please find the latest report on new defect(s) introduced to llvm found with Coverity Scan.
14 new defect(s) introduced to llvm found with Coverity Scan.
19 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 14 of 14 defect(s)
** CID 1506413: Uninitialized variables (UNINIT)
/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp: 1336 in ::SparseTensorConcatConverter::matchAndRewrite(mlir::sparse_tensor::ConcatenateOp, mlir::sparse_tensor::ConcatenateOpAdaptor, mlir::ConversionPatternRewriter &) const::[lambda(mlir::ValueRange) (instance 1)]::operator ()(mlir::ValueRange) const()
*** CID 1506413: Uninitialized variables (UNINIT)
/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp: 1336 in ::SparseTensorConcatConverter::matchAndRewrite(mlir::sparse_tensor::ConcatenateOp, mlir::sparse_tensor::ConcatenateOpAdaptor, mlir::ConversionPatternRewriter &) const::[lambda(mlir::ValueRange) (instance 1)]::operator ()(mlir::ValueRange) const()
1330 const auto dcvs2lcvs = [&](ValueRange dcvs) → SmallVector {
1331 SmallVector lcvs;
1332 lcvs.reserve(lvlRank);
1333 for (Level l = 0; l < lvlRank; l++)
1334 // FIXME: toOrigDim
is deprecated
1335 lcvs.push_back(dcvs[toOrigDim(dstEnc, l)]);
CID 1506413: Uninitialized variables (UNINIT) Using uninitialized value "lcvs". Field "lcvs.InlineElts" is uninitialized.
1336 return lcvs;
1337 };
1338 for (const auto &it : llvm::zip(op.getInputs(), adaptor.getInputs())) {
1339 Value orignalOp = std::get<0>(it); // Input (with encoding) from Op
1340 Value adaptedOp = std::get<1>(it); // Input (type converted) from adaptor
1341 const auto srcTp = getSparseTensorType(orignalOp);
** CID 1506412: Performance inefficiencies (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.inc: 375 in ::AddIMulNegativeOneLhs::matchAndRewrite(mlir::Operation *, mlir::PatternRewriter &) const()
*** CID 1506412: Performance inefficiencies (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.inc: 375 in ::AddIMulNegativeOneLhs::matchAndRewrite(mlir::Operation *, mlir::PatternRewriter &) const()
369 ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs;
370 tblgen_values.push_back((*y.begin()));
371 tblgen_values.push_back((*x.begin()));
372 tblgen_SubIOp_0 = rewriter.create<::mlir::arith::SubIOp>(odsLoc, tblgen_values, tblgen_attrs);
373 }
374
CID 1506412: Performance inefficiencies (AUTO_CAUSES_COPY) Using the "auto" keyword without an "&" causes the copy of an object of type Value.
375 for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SubIOp_0.getODSResults(0) }) {
376 tblgen_repl_values.push_back(v);
377 }
378
379 rewriter.replaceOp(op0, tblgen_repl_values);
380 return ::mlir::success();
** CID 1506411: Performance inefficiencies (AUTO_CAUSES_COPY)
/flang/lib/Lower/ConvertCall.cpp: 1163 in genIntrinsicRefCore(llvm::SmallVector<std::optional<::PreparedActualArgument>, (unsigned int)1> &, const Fortran::evaluate::SpecificIntrinsic *, const fir::IntrinsicArgumentLoweringRules *, ::CallContext &)()
*** CID 1506411: Performance inefficiencies (AUTO_CAUSES_COPY)
/flang/lib/Lower/ConvertCall.cpp: 1163 in genIntrinsicRefCore(llvm::SmallVector<std::optional<::PreparedActualArgument>, (unsigned int)1> &, const Fortran::evaluate::SpecificIntrinsic *, const fir::IntrinsicArgumentLoweringRules *, ::CallContext &)()
1157 CallContext &callContext) {
1158 llvm::SmallVectorfir::ExtendedValue operands;
1159 auto &stmtCtx = callContext.stmtCtx;
1160 auto &converter = callContext.converter;
1161 fir::FirOpBuilder &builder = callContext.getBuilder();
1162 mlir::Location loc = callContext.loc;
CID 1506411: Performance inefficiencies (AUTO_CAUSES_COPY) Using the "auto" keyword without an "&" causes the copy of an object of type result_pair.
1163 for (auto arg : llvm::enumerate(loweredActuals)) {
1164 if (!arg.value()) {
1165 operands.emplace_back(fir::getAbsentIntrinsicArgument());
1166 continue;
1167 }
1168 if (arg.value()->handleDynamicOptional())
** CID 1506410: (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.cpp.inc: 6626 in mlir::sparse_tensor::ToCoordinatesBufferOp::verifyInvariantsImpl()()
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.cpp.inc: 6635 in mlir::sparse_tensor::ToCoordinatesBufferOp::verifyInvariantsImpl()()
*** CID 1506410: (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.cpp.inc: 6626 in mlir::sparse_tensor::ToCoordinatesBufferOp::verifyInvariantsImpl()()
6620
6621 ::mlir::LogicalResult ToCoordinatesBufferOp::verifyInvariantsImpl() {
6622 {
6623 unsigned index = 0; (void)index;
6624 auto valueGroup0 = getODSOperands(0);
6625
CID 1506410: (AUTO_CAUSES_COPY) Using the "auto" keyword without an "&" causes the copy of an object of type Value.
6626 for (auto v : valueGroup0) {
6627 if (::mlir::failed(__mlir_ods_local_type_constraint_SparseTensorOps5(*this, v.getType(), “operand”, index++)))
6628 return ::mlir::failure();
6629 }
6630 }
6631 {
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.cpp.inc: 6635 in mlir::sparse_tensor::ToCoordinatesBufferOp::verifyInvariantsImpl()()
6629 }
6630 }
6631 {
6632 unsigned index = 0; (void)index;
6633 auto valueGroup0 = getODSResults(0);
6634
CID 1506410: (AUTO_CAUSES_COPY) Using the "auto" keyword without an "&" causes the copy of an object of type OpResult.
6635 for (auto v : valueGroup0) {
6636 if (::mlir::failed(__mlir_ods_local_type_constraint_SparseTensorOps1(*this, v.getType(), “result”, index++)))
6637 return ::mlir::failure();
6638 }
6639 }
6640 return ::mlir::success();
** CID 1506409: Uninitialized variables (UNINIT)
*** CID 1506409: Uninitialized variables (UNINIT)
/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp: 1604 in ::RISCVAsmParser::parseFPImm(llvm::SmallVectorImpl<std::unique_ptr<llvm::MCParsedAsmOperand, std::default_deletellvm::MCParsedAsmOperand>> &)()
1598 }
1599 unsigned F = RISCVLoadFPImm::getFPImm(Tok.getIntVal());
1600 Operands.push_back(RISCVOperand::createFPImm(F, S));
1601 } else {
1602 // Parse FP representation.
1603 APFloat RealVal(APFloat::IEEEsingle());
CID 1506409: Uninitialized variables (UNINIT) Using uninitialized value "RealVal.U" when calling "convertFromString".
1604 auto StatusOrErr =
1605 RealVal.convertFromString(Tok.getString(), APFloat::rmTowardZero);
1606 if (errorToBool(StatusOrErr.takeError())) {
1607 TokError(“invalid floating point representation”);
1608 return MatchOperand_ParseFail;
1609 }
** CID 1506408: Uninitialized variables (UNINIT)
/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp: 506 in llvm::gsym::GsymCreator::copyFunctionInfo(const llvm::gsym::GsymCreator&, unsigned long)()
*** CID 1506408: Uninitialized variables (UNINIT)
/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp: 506 in llvm::gsym::GsymCreator::copyFunctionInfo(const llvm::gsym::GsymCreator&, unsigned long)()
500 // Make a copy of the source inline information.
501 DstFI.Inline = SrcFI.Inline.value();
502 // Fixup all strings and files in the copied inline information.
503 fixupInlineInfo(SrcGC, *DstFI.Inline);
504 }
505 std::lock_guardstd::mutex Guard(Mutex);
CID 1506408: Uninitialized variables (UNINIT) Using uninitialized value "DstFI". Field "DstFI.EncodingCache.InlineElts" is uninitialized when calling "push_back". [Note: The source code implementation of the function has been overridden by a builtin model.]
506 Funcs.push_back(DstFI);
507 return Funcs.back().cacheEncoding();
508 }
509
510 llvm::Error GsymCreator::saveSegments(StringRef Path,
511 llvm::support::endianness ByteOrder,
** CID 1506407: (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.cpp.inc: 7137 in mlir::sparse_tensor::ToPositionsOp::verifyInvariantsImpl()()
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.cpp.inc: 7128 in mlir::sparse_tensor::ToPositionsOp::verifyInvariantsImpl()()
*** CID 1506407: (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.cpp.inc: 7137 in mlir::sparse_tensor::ToPositionsOp::verifyInvariantsImpl()()
7131 }
7132 }
7133 {
7134 unsigned index = 0; (void)index;
7135 auto valueGroup0 = getODSResults(0);
7136
CID 1506407: (AUTO_CAUSES_COPY) Using the "auto" keyword without an "&" causes the copy of an object of type OpResult.
7137 for (auto v : valueGroup0) {
7138 if (::mlir::failed(__mlir_ods_local_type_constraint_SparseTensorOps1(*this, v.getType(), “result”, index++)))
7139 return ::mlir::failure();
7140 }
7141 }
7142 return ::mlir::success();
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.cpp.inc: 7128 in mlir::sparse_tensor::ToPositionsOp::verifyInvariantsImpl()()
7122 if (::mlir::failed(__mlir_ods_local_attr_constraint_SparseTensorOps4(*this, tblgen_level, “level”)))
7123 return ::mlir::failure();
7124 {
7125 unsigned index = 0; (void)index;
7126 auto valueGroup0 = getODSOperands(0);
7127
CID 1506407: (AUTO_CAUSES_COPY) Using the "auto" keyword without an "&" causes the copy of an object of type Value.
7128 for (auto v : valueGroup0) {
7129 if (::mlir::failed(__mlir_ods_local_type_constraint_SparseTensorOps5(*this, v.getType(), “operand”, index++)))
7130 return ::mlir::failure();
7131 }
7132 }
7133 {
** CID 1506406: Null pointer dereferences (NULL_RETURNS)
*** CID 1506406: Null pointer dereferences (NULL_RETURNS)
/llvm/lib/Analysis/LazyCallGraph.cpp: 1765 in llvm::LazyCallGraph::addSplitRefRecursiveFunctions(llvm::Function &, llvm::ArrayRef<llvm::Function *>)()
1759 “Expected ref edges from original function to every new function”);
1760 Node &N1 = get(*F1);
1761 for (Function *F2 : NewFunctions) {
1762 if (F1 == F2)
1763 continue;
1764 Node &N2 = get(*F2);
CID 1506406: Null pointer dereferences (NULL_RETURNS) Dereferencing a pointer that might be "nullptr" "N1->lookup(N2)" when calling "isCall".
1765 assert(!N1->lookup(N2)->isCall() &&
1766 “Edges between new functions must be ref edges”);
1767 }
1768 }
1769 #endif
1770 }
** CID 1506405: Performance inefficiencies (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.inc: 448 in ::AddIMulNegativeOneRhs::matchAndRewrite(mlir::Operation *, mlir::PatternRewriter &) const()
*** CID 1506405: Performance inefficiencies (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.inc: 448 in ::AddIMulNegativeOneRhs::matchAndRewrite(mlir::Operation *, mlir::PatternRewriter &) const()
442 ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs;
443 tblgen_values.push_back((*x.begin()));
444 tblgen_values.push_back((*y.begin()));
445 tblgen_SubIOp_0 = rewriter.create<::mlir::arith::SubIOp>(odsLoc, tblgen_values, tblgen_attrs);
446 }
447
CID 1506405: Performance inefficiencies (AUTO_CAUSES_COPY) Using the "auto" keyword without an "&" causes the copy of an object of type Value.
448 for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SubIOp_0.getODSResults(0) }) {
449 tblgen_repl_values.push_back(v);
450 }
451
452 rewriter.replaceOp(op0, tblgen_repl_values);
453 return ::mlir::success();
** CID 1506404: (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.cpp.inc: 6877 in mlir::sparse_tensor::ToCoordinatesOp::verifyInvariantsImpl()()
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.cpp.inc: 6886 in mlir::sparse_tensor::ToCoordinatesOp::verifyInvariantsImpl()()
*** CID 1506404: (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.cpp.inc: 6877 in mlir::sparse_tensor::ToCoordinatesOp::verifyInvariantsImpl()()
6871 if (::mlir::failed(__mlir_ods_local_attr_constraint_SparseTensorOps4(*this, tblgen_level, “level”)))
6872 return ::mlir::failure();
6873 {
6874 unsigned index = 0; (void)index;
6875 auto valueGroup0 = getODSOperands(0);
6876
CID 1506404: (AUTO_CAUSES_COPY) Using the "auto" keyword without an "&" causes the copy of an object of type Value.
6877 for (auto v : valueGroup0) {
6878 if (::mlir::failed(__mlir_ods_local_type_constraint_SparseTensorOps5(*this, v.getType(), “operand”, index++)))
6879 return ::mlir::failure();
6880 }
6881 }
6882 {
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.cpp.inc: 6886 in mlir::sparse_tensor::ToCoordinatesOp::verifyInvariantsImpl()()
6880 }
6881 }
6882 {
6883 unsigned index = 0; (void)index;
6884 auto valueGroup0 = getODSResults(0);
6885
CID 1506404: (AUTO_CAUSES_COPY) Using the "auto" keyword without an "&" causes the copy of an object of type OpResult.
6886 for (auto v : valueGroup0) {
6887 if (::mlir::failed(__mlir_ods_local_type_constraint_SparseTensorOps1(*this, v.getType(), “result”, index++)))
6888 return ::mlir::failure();
6889 }
6890 }
6891 return ::mlir::success();
** CID 1506403: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/Transforms/Utils/DialectConversion.cpp: 1624 in mlir::ConversionPatternRewriter::inlineBlockBefore(mlir::Block *, mlir::Block *, llvm::ilist_iterator<llvm::ilist_detail::node_options<mlir::Operation, (bool)1, (bool)0, void>, (bool)0, (bool)0>, mlir::ValueRange)()
*** CID 1506403: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/Transforms/Utils/DialectConversion.cpp: 1624 in mlir::ConversionPatternRewriter::inlineBlockBefore(mlir::Block *, mlir::Block *, llvm::ilist_iterator<llvm::ilist_detail::node_options<mlir::Operation, (bool)1, (bool)0, void>, (bool)0, (bool)0>, mlir::ValueRange)()
1618 // The source block will be deleted, so it should not have any users (i.e.,
1619 // there should be no predecessors).
1620 assert(llvm::all_of(source->getUsers(), opIgnored) &&
1621 “expected ‘source’ to have no predecessors”);
1622
1623 impl->notifyBlockBeingInlined(dest, source, before);
CID 1506403: Performance inefficiencies (AUTO_CAUSES_COPY) Using the "auto" keyword without an "&" causes the copy of an object of type tuple.
1624 for (auto it : llvm::zip(source->getArguments(), argValues))
1625 replaceUsesOfBlockArgument(std::get<0>(it), std::get<1>(it));
1626 dest->getOperations().splice(before, source->getOperations());
1627 eraseBlock(source);
1628 }
1629
** CID 1506402: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/IR/PatternMatch.cpp: 342 in mlir::RewriterBase::inlineBlockBefore(mlir::Block *, mlir::Block *, llvm::ilist_iterator<llvm::ilist_detail::node_options<mlir::Operation, (bool)1, (bool)0, void>, (bool)0, (bool)0>, mlir::ValueRange)()
*** CID 1506402: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/IR/PatternMatch.cpp: 342 in mlir::RewriterBase::inlineBlockBefore(mlir::Block *, mlir::Block *, llvm::ilist_iterator<llvm::ilist_detail::node_options<mlir::Operation, (bool)1, (bool)0, void>, (bool)0, (bool)0>, mlir::ValueRange)()
336 // dest block should have no successors. Otherwise, the inserted operations
337 // will be unreachable.
338 assert(dest->hasNoSuccessors() && “expected ‘dest’ to have no successors”);
339 }
340
341 // Replace all of the successor arguments with the provided values.
CID 1506402: Performance inefficiencies (AUTO_CAUSES_COPY) Using the "auto" keyword without an "&" causes the copy of an object of type tuple.
342 for (auto it : llvm::zip(source->getArguments(), argValues))
343 replaceAllUsesWith(std::get<0>(it), std::get<1>(it));
344
345 // Move operations from the source block to the dest block and erase the
346 // source block.
347 dest->getOperations().splice(before, source->getOperations());
** CID 1506401: Uninitialized variables (UNINIT)
/flang/lib/Lower/ConvertCall.cpp: 1285 in genHLFIRIntrinsicRefCore(llvm::SmallVector<std::optional<::PreparedActualArgument>, (unsigned int)1> &, const Fortran::evaluate::SpecificIntrinsic *, const fir::IntrinsicArgumentLoweringRules *, ::CallContext &)::[lambda(llvm::SmallVector<std::optional<::PreparedActualArgument>, (unsigned int)1> &) (instance 1)]::operator ()(llvm::SmallVector<std::optional<::PreparedActualArgument>, (unsigned int)1> &) const()
*** CID 1506401: Uninitialized variables (UNINIT)
/flang/lib/Lower/ConvertCall.cpp: 1285 in genHLFIRIntrinsicRefCore(llvm::SmallVector<std::optional<::PreparedActualArgument>, (unsigned int)1> &, const Fortran::evaluate::SpecificIntrinsic *, const fir::IntrinsicArgumentLoweringRules *, ::CallContext &)::[lambda(llvm::SmallVector<std::optional<::PreparedActualArgument>, (unsigned int)1> &) (instance 1)]::operator ()(llvm::SmallVector<std::optional<::PreparedActualArgument>, (unsigned int)1> &) const()
1279 valArg = hlfir::derefPointersAndAllocatables(loc, builder, actual);
1280 else
1281 valArg = actual.getBase();
1282
1283 operands.emplace_back(valArg);
1284 }
CID 1506401: Uninitialized variables (UNINIT) Using uninitialized value "operands". Field "operands.InlineElts" is uninitialized.
1285 return operands;
1286 };
1287
1288 auto computeResultType = [&](mlir::Value argArray,
1289 mlir::Type stmtResultType) → mlir::Type {
1290 hlfir::ExprType::Shape resultShape;
** CID 1506400: Uninitialized variables (UNINIT)
/mlir/lib/Dialect/SparseTensor/Transforms/CodegenUtils.cpp: 617 in mlir::sparse_tensor::loadAll(mlir::OpBuilder &, mlir::Location, unsigned long, mlir::Value, unsigned long, mlir::Value)()
*** CID 1506400: Uninitialized variables (UNINIT)
/mlir/lib/Dialect/SparseTensor/Transforms/CodegenUtils.cpp: 617 in mlir::sparse_tensor::loadAll(mlir::OpBuilder &, mlir::Location, unsigned long, mlir::Value, unsigned long, mlir::Value)()
611 Value v = builder.creatememref::LoadOp(loc, mem,
612 constantIndex(builder, loc, i));
613 if (i == offsetIdx && offsetVal)
614 v = builder.createarith::AddIOp(loc, v, offsetVal);
615 vs.push_back(v);
616 }
CID 1506400: Uninitialized variables (UNINIT) Using uninitialized value "vs". Field "vs.InlineElts" is uninitialized.
617 return vs;
618 }
619
620 void sparse_tensor::storeAll(OpBuilder &builder, Location loc, Value mem,
621 ValueRange vs, size_t offsetIdx, Value offsetVal) {
622 #ifndef NDEBUG
To view the defects in Coverity Scan visit, Coverity Scan - Sign in