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.

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

** CID 1522754: Control flow issues (DEADCODE)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp.inc: 14340 in mlir::transform::VectorizeChildrenAndApplyPatternsOp::setDisableTransferPermutationMapLoweringPatterns(bool)()


*** CID 1522754: Control flow issues (DEADCODE)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp.inc: 14340 in mlir::transform::VectorizeChildrenAndApplyPatternsOp::setDisableTransferPermutationMapLoweringPatterns(bool)()
14334 void VectorizeChildrenAndApplyPatternsOp::setDisableTransferPermutationMapLoweringPatternsAttr(::mlir::UnitAttr attr) {
14335 (*this)->setAttr(getDisableTransferPermutationMapLoweringPatternsAttrName(), attr);
14336 }
14337
14338 void VectorizeChildrenAndApplyPatternsOp::setDisableTransferPermutationMapLoweringPatterns(bool attrValue) {
14339 if (attrValue)

CID 1522754:  Control flow issues  (DEADCODE)
Execution cannot reach this statement: "<temporary>.UnitAttr(NULL);".

14340 return (*this)->setAttr(getDisableTransferPermutationMapLoweringPatternsAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr));
14341 (*this)->removeAttr(getDisableTransferPermutationMapLoweringPatternsAttrName());
14342 }
14343
14344 ::mlir::Attribute VectorizeChildrenAndApplyPatternsOp::removeVectorizePaddingAttr() {
14345 auto &attr = getProperties().vectorize_padding;

** CID 1522753: Performance inefficiencies (PASS_BY_VALUE)
/flang/lib/Lower/ConvertCall.cpp: 487 in Fortran::lower::genCallOpAndResult(mlir::Location, Fortran::lower::AbstractConverter &, Fortran::lower::SymMap &, Fortran::lower::StatementContext &, Fortran::lower::CallerInterface &, mlir::FunctionType, std::optionalmlir::Type, bool)::[lambda() (instance 3)]::operator ()() const()


*** CID 1522753: Performance inefficiencies (PASS_BY_VALUE)
/flang/lib/Lower/ConvertCall.cpp: 487 in Fortran::lower::genCallOpAndResult(mlir::Location, Fortran::lower::AbstractConverter &, Fortran::lower::SymMap &, Fortran::lower::StatementContext &, Fortran::lower::CallerInterface &, mlir::FunctionType, std::optionalmlir::Type, bool)::[lambda() (instance 3)]::operator ()() const()
481 // or have allocatable components, we need to make sure
482 // everything is properly finalized/deallocated.
483 if (Fortran::semantics::MayRequireFinalization(typeSpec) ||
484 // We can use DerivedTypeDestroy even if finalization is not needed.
485 hlfir::mayHaveAllocatableComponent(funcType.getResults()[0])) {
486 auto *bldr = &converter.getFirOpBuilder();

CID 1522753:  Performance inefficiencies  (PASS_BY_VALUE)
Capturing variable "allocatedResult" of type "std::optional<fir::ExtendedValue>" (size 256 bytes) by value, which exceeds the low threshold of 128 bytes.

487 stmtCtx.attachCleanup(bldr, loc, allocatedResult {
488 mlir::Value box = bldr->createBox(loc, *allocatedResult);
489 fir::runtime::genDerivedTypeDestroy(*bldr, loc, box);
490 });
491 }
492 }

** CID 1522752: Performance inefficiencies (PASS_BY_VALUE)
/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp: 837 in llvm::GCNTargetMachine::GCNTargetMachine(const llvm::Target &, const llvm::Triple &, llvm::StringRef, llvm::StringRef, llvm::TargetOptions, std::optionalllvm::Reloc::Model, std::optionalllvm::CodeModel::Model, llvm::CodeGenOptLevel, bool)()


*** CID 1522752: Performance inefficiencies (PASS_BY_VALUE)
/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp: 837 in llvm::GCNTargetMachine::GCNTargetMachine(const llvm::Target &, const llvm::Triple &, llvm::StringRef, llvm::StringRef, llvm::TargetOptions, std::optionalllvm::Reloc::Model, std::optionalllvm::CodeModel::Model, llvm::CodeGenOptLevel, bool)()
831 //===----------------------------------------------------------------------===//
832 // GCN Target Machine (SI+)
833 //===----------------------------------------------------------------------===//
834
835 GCNTargetMachine::GCNTargetMachine(const Target &T, const Triple &TT,
836 StringRef CPU, StringRef FS,

CID 1522752:  Performance inefficiencies  (PASS_BY_VALUE)
Passing parameter Options of type "llvm::TargetOptions" (size 360 bytes) by value, which exceeds the medium threshold of 256 bytes.

837 TargetOptions Options,
838 std::optionalReloc::Model RM,
839 std::optionalCodeModel::Model CM,
840 CodeGenOptLevel OL, bool JIT)
841 : AMDGPUTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL) {}
842

** CID 1522651: (SIGN_EXTENSION)
/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp: 291 in DynamicLoaderFreeBSDKernel::KModImageInfo::ReadMemoryModule(lldb_private::Process *)()
/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp: 283 in DynamicLoaderFreeBSDKernel::KModImageInfo::ReadMemoryModule(lldb_private::Process *)()


*** CID 1522651: (SIGN_EXTENSION)
/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp: 291 in DynamicLoaderFreeBSDKernel::KModImageInfo::ReadMemoryModule(lldb_private::Process *)()
285 llvm::elf::ELFCLASS64) {
286 llvm::elf::Elf64_Ehdr elf_eheader;
287 Status error;
288 if (process->ReadMemory(m_load_address, &elf_eheader, sizeof(elf_eheader),
289 error) == sizeof(elf_eheader))
290 size_to_read = sizeof(llvm::elf::Elf64_Ehdr) +

CID 1522651:    (SIGN_EXTENSION)
Suspicious implicit sign extension: "elf_eheader.e_phentsize" with type "llvm::ELF::Elf64_Half" (16 bits, unsigned) is promoted in "elf_eheader.e_phnum * elf_eheader.e_phentsize" to type "int" (32 bits, signed), then sign-extended to type "unsigned long" (64 bits, unsigned).  If "elf_eheader.e_phnum * elf_eheader.e_phentsize" is greater than 0x7FFFFFFF, the upper bits of the result will all be 1.

291 elf_eheader.e_phnum * elf_eheader.e_phentsize;
292 }
293 }
294
295 memory_module_sp =
296 process->ReadModuleFromMemory(file_spec, m_load_address, size_to_read);
/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp: 283 in DynamicLoaderFreeBSDKernel::KModImageInfo::ReadMemoryModule(lldb_private::Process *)()
277 llvm::elf::Elf32_Ehdr elf_eheader;
278 size_t size_to_read = 512;
279
280 if (ReadELFHeader(process, m_load_address, elf_eheader)) {
281 if (elf_eheader.e_ident[llvm::elf::EI_CLASS] == llvm::elf::ELFCLASS32) {
282 size_to_read = sizeof(llvm::elf::Elf32_Ehdr) +

CID 1522651:    (SIGN_EXTENSION)
Suspicious implicit sign extension: "elf_eheader.e_phentsize" with type "llvm::ELF::Elf32_Half" (16 bits, unsigned) is promoted in "elf_eheader.e_phnum * elf_eheader.e_phentsize" to type "int" (32 bits, signed), then sign-extended to type "unsigned long" (64 bits, unsigned).  If "elf_eheader.e_phnum * elf_eheader.e_phentsize" is greater than 0x7FFFFFFF, the upper bits of the result will all be 1.

283 elf_eheader.e_phnum * elf_eheader.e_phentsize;
284 } else if (elf_eheader.e_ident[llvm::elf::EI_CLASS] ==
285 llvm::elf::ELFCLASS64) {
286 llvm::elf::Elf64_Ehdr elf_eheader;
287 Status error;
288 if (process->ReadMemory(m_load_address, &elf_eheader, sizeof(elf_eheader),

** CID 1522572: Uninitialized variables (UNINIT)
/clang/lib/Sema/SemaTemplateDeduction.cpp: 4633 in clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl *, clang::QualType, clang::Expr::Classification, clang::QualType, clang::CXXConversionDecl *&, clang::sema::TemplateDeductionInfo &)()


*** CID 1522572: Uninitialized variables (UNINIT)
/clang/lib/Sema/SemaTemplateDeduction.cpp: 4633 in clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl *, clang::QualType, clang::Expr::Classification, clang::QualType, clang::CXXConversionDecl *&, clang::sema::TemplateDeductionInfo &)()
4627 runWithSufficientStackSpace(Info.getLocation(), [&] {
4628 Result = FinishTemplateArgumentDeduction(ConversionTemplate, Deduced, 0,
4629 ConversionSpecialized, Info,
4630 &OriginalCallArgs);
4631 });
4632 Specialization = cast_or_null(ConversionSpecialized);

CID 1522572:  Uninitialized variables  (UNINIT)
Using uninitialized value "Result".

4633 return Result;
4634 }
4635
4636 /// Deduce template arguments for a function template when there is
4637 /// nothing to deduce against (C++0x [temp.arg.explicit]p3).
4638 ///

** CID 1522571: Performance inefficiencies (AUTO_CAUSES_COPY)
/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp: 6445 in llvm::slpvectorizer::BoUpSLP::canReuseExtract(llvm::ArrayRef<llvm::Value *>, llvm::Value *, llvm::SmallVectorImpl &, bool) const()


*** CID 1522571: Performance inefficiencies (AUTO_CAUSES_COPY)
/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp: 6445 in llvm::slpvectorizer::BoUpSLP::canReuseExtract(llvm::ArrayRef<llvm::Value *>, llvm::Value *, llvm::SmallVectorImpl &, bool) const()
6439
6440 unsigned E = VL.size();
6441 if (!ResizeAllowed && NElts != E)
6442 return false;
6443 SmallVector Indices(E, PoisonMaskElem);
6444 unsigned MinIdx = NElts, MaxIdx = 0;

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

6445 for (auto [I, V] : enumerate(VL)) {
6446 auto *Inst = dyn_cast(V);
6447 if (!Inst)
6448 continue;
6449 if (Inst->getOperand(0) != Vec)
6450 return false;

** CID 1522570: (AUTO_CAUSES_COPY)
/bolt/lib/Profile/YAMLProfileReader.cpp: 341 in llvm::bolt::YAMLProfileReader::readProfile(llvm::bolt::BinaryContext &)()
/bolt/lib/Profile/YAMLProfileReader.cpp: 385 in llvm::bolt::YAMLProfileReader::readProfile(llvm::bolt::BinaryContext &)()


*** CID 1522570: (AUTO_CAUSES_COPY)
/bolt/lib/Profile/YAMLProfileReader.cpp: 341 in llvm::bolt::YAMLProfileReader::readProfile(llvm::bolt::BinaryContext &)()
335 return Profile.Hash == static_cast<uint64_t>(BF.getHash());
336 };
337
338 // We have to do 2 passes since LTO introduces an ambiguity in function
339 // names. The first pass assigns profiles that match 100% by name and
340 // by hash. The second pass allows name ambiguity for LTO private functions.

CID 1522570:    (AUTO_CAUSES_COPY)
Using the "auto" keyword without an "&" causes the copy of an object of type tuple.

341 for (auto [YamlBF, BF] : llvm::zip_equal(YamlBP.Functions, ProfileBFs)) {
342 if (!BF)
343 continue;
344 BinaryFunction &Function = *BF;
345 // Clear function call count that may have been set while pre-processing
346 // the profile.
/bolt/lib/Profile/YAMLProfileReader.cpp: 385 in llvm::bolt::YAMLProfileReader::readProfile(llvm::bolt::BinaryContext &)()
379 if (!ProfileMatched && LTOProfiles.size() == 1 && Functions.size() == 1 &&
380 !LTOProfiles.front()->Used &&
381 !ProfiledFunctions.count(*Functions.begin()))
382 matchProfileToFunction(*LTOProfiles.front(), **Functions.begin());
383 }
384

CID 1522570:    (AUTO_CAUSES_COPY)
Using the "auto" keyword without an "&" causes the copy of an object of type tuple.

385 for (auto [YamlBF, BF] : llvm::zip_equal(YamlBP.Functions, ProfileBFs))
386 if (!YamlBF.Used && BF && !ProfiledFunctions.count(BF))
387 matchProfileToFunction(YamlBF, *BF);
388
389 for (yaml::bolt::BinaryFunctionProfile &YamlBF : YamlBP.Functions)
390 if (!YamlBF.Used && opts::Verbosity >= 1)

** CID 1522569: Control flow issues (DEADCODE)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.cpp.inc: 1578 in mlir::bufferization::MaterializeInDestinationOp::build(mlir::OpBuilder &, mlir::OperationState &, mlir::Type, mlir::Value, mlir::Value, bool, bool)()


*** CID 1522569: Control flow issues (DEADCODE)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.cpp.inc: 1578 in mlir::bufferization::MaterializeInDestinationOp::build(mlir::OpBuilder &, mlir::OperationState &, mlir::Type, mlir::Value, mlir::Value, bool, bool)()
1572 odsState.addOperands(source);
1573 odsState.addOperands(dest);
1574 if (restrict) {
1575 odsState.getOrAddProperties().restrict = ((restrict) ? odsBuilder.getUnitAttr() : nullptr);
1576 }
1577 if (writable) {

CID 1522569:  Control flow issues  (DEADCODE)
Execution cannot reach this statement: "<temporary>.UnitAttr(NULL);".

1578 odsState.getOrAddProperties().writable = ((writable) ? odsBuilder.getUnitAttr() : nullptr);
1579 }
1580 if (result)
1581 odsState.addTypes(result);
1582 }
1583

** CID 1522568: Uninitialized members (UNINIT_CTOR)
/llvm/tools/dsymutil/MachODebugMapParser.cpp: 34 in ::MachODebugMapParser::MachODebugMapParser(llvm::IntrusiveRefCntPtrllvm::vfs::FileSystem, llvm::StringRef, llvm::ArrayRef<std::__cxx11::basic_string<char, std::char_traits, std::allocator>>, llvm::StringRef, bool)()


*** CID 1522568: Uninitialized members (UNINIT_CTOR)
/llvm/tools/dsymutil/MachODebugMapParser.cpp: 34 in ::MachODebugMapParser::MachODebugMapParser(llvm::IntrusiveRefCntPtrllvm::vfs::FileSystem, llvm::StringRef, llvm::ArrayRef<std::__cxx11::basic_string<char, std::char_traits, std::allocator>>, llvm::StringRef, bool)()
28 public:
29 MachODebugMapParser(llvm::IntrusiveRefCntPtrllvm::vfs::FileSystem VFS,
30 StringRef BinaryPath, ArrayRefstd::string Archs,
31 StringRef PathPrefix = “”, bool Verbose = false)
32 : BinaryPath(std::string(BinaryPath)), Archs(Archs.begin(), Archs.end()),
33 PathPrefix(std::string(PathPrefix)), BinHolder(VFS, Verbose),

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

34 CurrentDebugMapObject(nullptr), SkipDebugMapObject(false) {}
35
36 /// Parses and returns the DebugMaps of the input binary. The binary contains
37 /// multiple maps in case it is a universal binary.
38 /// \returns an error in case the provided BinaryPath doesn’t exist
39 /// or isn’t of a supported type.

** CID 1522567: Null pointer dereferences (NULL_RETURNS)


*** CID 1522567: Null pointer dereferences (NULL_RETURNS)
/clang/lib/CodeGen/CGExpr.cpp: 950 in getArrayIndexingBound(clang::CodeGen::CodeGenFunction &, const clang::Expr *, clang::QualType &, clang::LangOptions::StrictFlexArraysLevelKind)()
944 // Ignore pass_object_size here. It’s not applicable on decayed pointers.
945 }
946
947 if (FieldDecl *FD = CGF.FindCountedByField(Base, StrictFlexArraysLevel)) {
948 const auto *ME = dyn_cast(CE->getSubExpr());
949 IndexedType = Base->getType();

CID 1522567:  Null pointer dereferences  (NULL_RETURNS)
Dereferencing a pointer that might be "nullptr" "ME" when calling "getBase".

950 return CGF
951 .EmitAnyExprToTemp(MemberExpr::CreateImplicit(
952 CGF.getContext(), const_cast<Expr *>(ME->getBase()),
953 ME->isArrow(), FD, FD->getType(), VK_LValue, OK_Ordinary))
954 .getScalarVal();
955 }

** CID 1522566: Performance inefficiencies (PASS_BY_VALUE)
/mlir/test/lib/Interfaces/TilingInterface/TestTilingInterface.cpp: 150 in ::TestTileUsingSCFForOp::TestTileUsingSCFForOp(mlir::MLIRContext *, mlir::scf::SCFTilingOptions, ::TransformationFilter, mlir::PatternBenefit)()


*** CID 1522566: Performance inefficiencies (PASS_BY_VALUE)
/mlir/test/lib/Interfaces/TilingInterface/TestTilingInterface.cpp: 150 in ::TestTileUsingSCFForOp::TestTileUsingSCFForOp(mlir::MLIRContext *, mlir::scf::SCFTilingOptions, ::TransformationFilter, mlir::PatternBenefit)()
144 /// Pattern for testing TileUsingSCFForOp pattern (that tiles operations using
145 /// the TilingInterface with scf.for ops for iterating over the tiles) while
146 /// using a filter to avoid recursive application.
147 struct TestTileUsingSCFForOp
148 : public OpInterfaceRewritePattern {
149 TestTileUsingSCFForOp(MLIRContext *context, scf::SCFTilingOptions options,

CID 1522566:  Performance inefficiencies  (PASS_BY_VALUE)
Passing parameter filter of type "<unnamed>::TransformationFilter" (size 136 bytes) by value, which exceeds the low threshold of 128 bytes.

150 TransformationFilter filter = TransformationFilter(),
151 PatternBenefit benefit = 1)
152 : OpInterfaceRewritePattern(context, benefit),
153 options(std::move(options)), filter(std::move(filter)) {}
154
155 /// Construct a generic pattern applied to opName.

** CID 1522565: Control flow issues (DEADCODE)
/build-llvm/tools/clang/stage2-bins/tools/flang/include/flang/Optimizer/Dialect/FIROps.cpp.inc: 19652 in fir::TypeInfoOp::setNoFinal(bool)()


*** CID 1522565: Control flow issues (DEADCODE)
/build-llvm/tools/clang/stage2-bins/tools/flang/include/flang/Optimizer/Dialect/FIROps.cpp.inc: 19652 in fir::TypeInfoOp::setNoFinal(bool)()
19646 void TypeInfoOp::setNoFinalAttr(::mlir::UnitAttr attr) {
19647 (*this)->setAttr(getNoFinalAttrName(), attr);
19648 }
19649
19650 void TypeInfoOp::setNoFinal(bool attrValue) {
19651 if (attrValue)

CID 1522565:  Control flow issues  (DEADCODE)
Execution cannot reach this statement: "<temporary>.UnitAttr(NULL);".

19652 return (*this)->setAttr(getNoFinalAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr));
19653 (*this)->removeAttr(getNoFinalAttrName());
19654 }
19655
19656 ::mlir::Attribute TypeInfoOp::removeParentTypeAttr() {
19657 auto &attr = getProperties().parent_type;

** CID 1522564: (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.cpp.inc: 404 in mlir::transform::ForallToForOp::verifyInvariantsImpl()()
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.cpp.inc: 413 in mlir::transform::ForallToForOp::verifyInvariantsImpl()()


*** CID 1522564: (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.cpp.inc: 404 in mlir::transform::ForallToForOp::verifyInvariantsImpl()()
398
399 ::mlir::LogicalResult ForallToForOp::verifyInvariantsImpl() {
400 {
401 unsigned index = 0; (void)index;
402 auto valueGroup0 = getODSOperands(0);
403

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

404 for (auto v : valueGroup0) {
405 if (::mlir::failed(__mlir_ods_local_type_constraint_SCFTransformOps0(*this, v.getType(), “operand”, index++)))
406 return ::mlir::failure();
407 }
408 }
409 {
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.cpp.inc: 413 in mlir::transform::ForallToForOp::verifyInvariantsImpl()()
407 }
408 }
409 {
410 unsigned index = 0; (void)index;
411 auto valueGroup0 = getODSResults(0);
412

CID 1522564:    (AUTO_CAUSES_COPY)
Using the "auto" keyword without an "&" causes the copy of an object of type OpResult.

413 for (auto v : valueGroup0) {
414 if (::mlir::failed(__mlir_ods_local_type_constraint_SCFTransformOps0(*this, v.getType(), “result”, index++)))
415 return ::mlir::failure();
416 }
417 }
418 return ::mlir::success();

** CID 1522563: (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.cpp.inc: 1622 in mlir::bufferization::MaterializeInDestinationOp::verifyInvariantsImpl()()
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.cpp.inc: 1636 in mlir::bufferization::MaterializeInDestinationOp::verifyInvariantsImpl()()
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.cpp.inc: 1616 in mlir::bufferization::MaterializeInDestinationOp::verifyInvariantsImpl()()


*** CID 1522563: (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.cpp.inc: 1622 in mlir::bufferization::MaterializeInDestinationOp::verifyInvariantsImpl()()
1616 for (auto v : valueGroup0) {
1617 if (::mlir::failed(__mlir_ods_local_type_constraint_BufferizationOps1(*this, v.getType(), “operand”, index++)))
1618 return ::mlir::failure();
1619 }
1620 auto valueGroup1 = getODSOperands(1);
1621

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

1622 for (auto v : valueGroup1) {
1623 if (::mlir::failed(__mlir_ods_local_type_constraint_BufferizationOps4(*this, v.getType(), “operand”, index++)))
1624 return ::mlir::failure();
1625 }
1626 }
1627 {
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.cpp.inc: 1636 in mlir::bufferization::MaterializeInDestinationOp::verifyInvariantsImpl()()
1630
1631 if (valueGroup0.size() > 1) {
1632 return emitOpError(“result group starting at #”) << index
1633 << " requires 0 or 1 element, but found " << valueGroup0.size();
1634 }
1635

CID 1522563:    (AUTO_CAUSES_COPY)
Using the "auto" keyword without an "&" causes the copy of an object of type OpResult.

1636 for (auto v : valueGroup0) {
1637 if (::mlir::failed(__mlir_ods_local_type_constraint_BufferizationOps1(*this, v.getType(), “result”, index++)))
1638 return ::mlir::failure();
1639 }
1640 }
1641 if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getShape()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getShape()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape()))))
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.cpp.inc: 1616 in mlir::bufferization::MaterializeInDestinationOp::verifyInvariantsImpl()()
1610 if (::mlir::failed(__mlir_ods_local_attr_constraint_BufferizationOps1(*this, tblgen_writable, “writable”)))
1611 return ::mlir::failure();
1612 {
1613 unsigned index = 0; (void)index;
1614 auto valueGroup0 = getODSOperands(0);
1615

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

1616 for (auto v : valueGroup0) {
1617 if (::mlir::failed(__mlir_ods_local_type_constraint_BufferizationOps1(*this, v.getType(), “operand”, index++)))
1618 return ::mlir::failure();
1619 }
1620 auto valueGroup1 = getODSOperands(1);
1621

** CID 1522562: (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.cpp.inc: 1381 in mlir::ROCDL::CvtF32Fp8Op::verifyInvariantsImpl()()
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.cpp.inc: 1366 in mlir::ROCDL::CvtF32Fp8Op::verifyInvariantsImpl()()
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.cpp.inc: 1372 in mlir::ROCDL::CvtF32Fp8Op::verifyInvariantsImpl()()


*** CID 1522562: (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.cpp.inc: 1381 in mlir::ROCDL::CvtF32Fp8Op::verifyInvariantsImpl()()
1375 }
1376 }
1377 {
1378 unsigned index = 0; (void)index;
1379 auto valueGroup0 = getODSResults(0);
1380

CID 1522562:    (AUTO_CAUSES_COPY)
Using the "auto" keyword without an "&" causes the copy of an object of type OpResult.

1381 for (auto v : valueGroup0) {
1382 if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), “result”, index++)))
1383 return ::mlir::failure();
1384 }
1385 }
1386 return ::mlir::success();
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.cpp.inc: 1366 in mlir::ROCDL::CvtF32Fp8Op::verifyInvariantsImpl()()
1360
1361 ::mlir::LogicalResult CvtF32Fp8Op::verifyInvariantsImpl() {
1362 {
1363 unsigned index = 0; (void)index;
1364 auto valueGroup0 = getODSOperands(0);
1365

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

1366 for (auto v : valueGroup0) {
1367 if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), “operand”, index++)))
1368 return ::mlir::failure();
1369 }
1370 auto valueGroup1 = getODSOperands(1);
1371
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.cpp.inc: 1372 in mlir::ROCDL::CvtF32Fp8Op::verifyInvariantsImpl()()
1366 for (auto v : valueGroup0) {
1367 if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), “operand”, index++)))
1368 return ::mlir::failure();
1369 }
1370 auto valueGroup1 = getODSOperands(1);
1371

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

1372 for (auto v : valueGroup1) {
1373 if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), “operand”, index++)))
1374 return ::mlir::failure();
1375 }
1376 }
1377 {

** CID 1522561: Performance inefficiencies (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/EmitC/IR/EmitC.cpp.inc: 2314 in mlir::emitc::IfOp::verifyInvariantsImpl()()


*** CID 1522561: Performance inefficiencies (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/EmitC/IR/EmitC.cpp.inc: 2314 in mlir::emitc::IfOp::verifyInvariantsImpl()()
2308
2309 ::mlir::LogicalResult IfOp::verifyInvariantsImpl() {
2310 {
2311 unsigned index = 0; (void)index;
2312 auto valueGroup0 = getODSOperands(0);
2313

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

2314 for (auto v : valueGroup0) {
2315 if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC2(*this, v.getType(), “operand”, index++)))
2316 return ::mlir::failure();
2317 }
2318 }
2319 {

** CID 1522560: (AUTO_CAUSES_COPY)
/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp: 6929 in ObjectFileMachO::GetCorefileAllImageInfos()()
/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp: 6985 in ObjectFileMachO::GetCorefileAllImageInfos()()


*** CID 1522560: (AUTO_CAUSES_COPY)
/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp: 6929 in ObjectFileMachO::GetCorefileAllImageInfos()()
6923 ObjectFileMachO::GetCorefileAllImageInfos() {
6924 MachOCorefileAllImageInfos image_infos;
6925 Log *log(GetLog(LLDBLog::Object | LLDBLog::Symbols | LLDBLog::Process |
6926 LLDBLog::DynamicLoader));
6927
6928 auto lc_notes = FindLC_NOTEByName(“all image infos”);

CID 1522560:    (AUTO_CAUSES_COPY)
Using the "auto" keyword without an "&" causes the copy of an object of type tuple.

6929 for (auto lc_note : lc_notes) {
6930 offset_t payload_offset = std::get<0>(lc_note);
6931 // Read the struct all_image_infos_header.
6932 uint32_t version = m_data.GetU32(&payload_offset);
6933 if (version != 1) {
6934 return image_infos;
/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp: 6985 in ObjectFileMachO::GetCorefileAllImageInfos()()
6979 : “not currently executing”);
6980 image_infos.all_image_infos.push_back(image_entry);
6981 }
6982 }
6983
6984 lc_notes = FindLC_NOTEByName(“load binary”);

CID 1522560:    (AUTO_CAUSES_COPY)
Using the "auto" keyword without an "&" causes the copy of an object of type tuple.

6985 for (auto lc_note : lc_notes) {
6986 offset_t payload_offset = std::get<0>(lc_note);
6987 uint32_t version = m_data.GetU32(&payload_offset);
6988 if (version == 1) {
6989 uuid_t uuid;
6990 memcpy(&uuid, m_data.GetData(&payload_offset, sizeof(uuid_t)),

** CID 1522559: Memory - corruptions (ARRAY_VS_SINGLETON)


*** CID 1522559: Memory - corruptions (ARRAY_VS_SINGLETON)
/compiler-rt/lib/dfsan/dfsan_custom.cpp: 2863 in __dfso_sscanf()
2857 dfsan_label format_label, dfsan_label *va_labels,
2858 dfsan_label *ret_label, dfsan_origin str_origin,
2859 dfsan_origin format_origin, dfsan_origin *va_origins,
2860 dfsan_origin *ret_origin, …) {
2861 va_list ap;
2862 va_start(ap, ret_origin);

CID 1522559:  Memory - corruptions  (ARRAY_VS_SINGLETON)
Passing "&str_origin" to function "scan_buffer" which uses it as an array. This might corrupt or misinterpret adjacent memory locations.

2863 int ret = scan_buffer(str, ~0ul, format, va_labels, ret_label, &str_origin,
2864 ret_origin, ap);
2865 va_end(ap);
2866 return ret;
2867 }
2868

** CID 1522558: Performance inefficiencies (AUTO_CAUSES_COPY)
/flang/lib/Lower/ConvertCall.cpp: 337 in Fortran::lower::genCallOpAndResult(mlir::Location, Fortran::lower::AbstractConverter &, Fortran::lower::SymMap &, Fortran::lower::StatementContext &, Fortran::lower::CallerInterface &, mlir::FunctionType, std::optionalmlir::Type, bool)()


*** CID 1522558: Performance inefficiencies (AUTO_CAUSES_COPY)
/flang/lib/Lower/ConvertCall.cpp: 337 in Fortran::lower::genCallOpAndResult(mlir::Location, Fortran::lower::AbstractConverter &, Fortran::lower::SymMap &, Fortran::lower::StatementContext &, Fortran::lower::CallerInterface &, mlir::FunctionType, std::optionalmlir::Type, bool)()
331 : builder.createConvert(loc, funcType, funcPointer));
332 }
333
334 // Deal with potential mismatches in arguments types. Passing an array to a
335 // scalar argument should for instance be tolerated here.
336 bool callingImplicitInterface = caller.canBeCalledViaImplicitInterface();

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

337 for (auto [fst, snd] : llvm::zip(caller.getInputs(), funcType.getInputs())) {
338 // When passing arguments to a procedure that can be called by implicit
339 // interface, allow any character actual arguments to be passed to dummy
340 // arguments of any type and vice versa.
341 mlir::Value cast;
342 auto *context = builder.getContext();

** CID 1522557: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/Dialect/LLVMIR/Transforms/AddComdats.cpp: 56 in ::AddComdatsPass::runOnOperation()()


*** CID 1522557: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/Dialect/LLVMIR/Transforms/AddComdats.cpp: 56 in ::AddComdatsPass::runOnOperation()()
50 std::unique_ptr symbolTable;
51 auto getSymTab = & → SymbolTable & {
52 if (!symbolTable)
53 symbolTable = std::make_unique(mod);
54 return *symbolTable;
55 };

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

56 for (auto op : mod.getBody()->getOpsLLVM::LLVMFuncOp()) {
57 if (op.getLinkage() == LLVM::Linkage::Linkonce ||
58 op.getLinkage() == LLVM::Linkage::LinkonceODR) {
59 addComdat(op, builder, getSymTab(), mod);
60 }
61 }
62 }
63 };


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