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.

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

** CID 1506559: Performance inefficiencies (AUTO_CAUSES_COPY)
/bolt/lib/Core/BinaryFunction.cpp: 4091 in llvm::bolt::BinaryFunction::updateOutputValues(const llvm::MCAsmLayout &)()


*** CID 1506559: Performance inefficiencies (AUTO_CAUSES_COPY)
/bolt/lib/Core/BinaryFunction.cpp: 4091 in llvm::bolt::BinaryFunction::updateOutputValues(const llvm::MCAsmLayout &)()
4085 setOutputAddress(BaseAddress + StartOffset);
4086 setOutputSize(EndOffset - StartOffset);
4087 if (hasConstantIsland()) {
4088 const uint64_t DataOffset =
4089 Layout.getSymbolOffset(*getFunctionConstantIslandLabel());
4090 setOutputDataAddress(BaseAddress + DataOffset);

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

4091 for (auto It : Islands->Offsets) {
4092 const uint64_t OldOffset = It.first;
4093 BinaryData *BD = BC.getBinaryDataAtAddress(getAddress() + OldOffset);
4094 if (!BD)
4095 continue;
4096

** CID 1506558: (NO_EFFECT)
/bolt/lib/Rewrite/RewriteInstance.cpp: 5158 in llvm::bolt::RewriteInstance::patchELFAllocatableRelaSections<llvm::object::ELFType<(llvm::support::endianness)0, (bool)1>>(llvm::object::ELFObjectFile *)::[lambda(unsigned long, unsigned long &, unsigned long &) (instance 1)]::operator ()(unsigned long, unsigned long &, unsigned long &) const()
/bolt/lib/Rewrite/RewriteInstance.cpp: 5158 in llvm::bolt::RewriteInstance::patchELFAllocatableRelaSections<llvm::object::ELFType<(llvm::support::endianness)1, (bool)1>>(llvm::object::ELFObjectFile *)::[lambda(unsigned long, unsigned long &, unsigned long &) (instance 1)]::operator ()(unsigned long, unsigned long &, unsigned long &) const()
/bolt/lib/Rewrite/RewriteInstance.cpp: 5158 in llvm::bolt::RewriteInstance::patchELFAllocatableRelaSections<llvm::object::ELFType<(llvm::support::endianness)0, (bool)0>>(llvm::object::ELFObjectFile *)::[lambda(unsigned long, unsigned long &, unsigned long &) (instance 1)]::operator ()(unsigned long, unsigned long &, unsigned long &) const()
/bolt/lib/Rewrite/RewriteInstance.cpp: 5158 in llvm::bolt::RewriteInstance::patchELFAllocatableRelaSections<llvm::object::ELFType<(llvm::support::endianness)1, (bool)0>>(llvm::object::ELFObjectFile *)::[lambda(unsigned long, unsigned long &, unsigned long &) (instance 1)]::operator ()(unsigned long, unsigned long &, unsigned long &) const()


*** CID 1506558: (NO_EFFECT)
/bolt/lib/Rewrite/RewriteInstance.cpp: 5158 in llvm::bolt::RewriteInstance::patchELFAllocatableRelaSections<llvm::object::ELFType<(llvm::support::endianness)0, (bool)1>>(llvm::object::ELFObjectFile *)::[lambda(unsigned long, unsigned long &, unsigned long &) (instance 1)]::operator ()(unsigned long, unsigned long &, unsigned long &) const()
5152 uint64_t RelDynOffset = 0, RelDynEndOffset = 0;
5153 uint64_t RelPltOffset = 0, RelPltEndOffset = 0;
5154
5155 auto setSectionFileOffsets = [&](uint64_t Address, uint64_t &Start,
5156 uint64_t &End) {
5157 ErrorOr<BinarySection &> Section = BC->getSectionForAddress(Address);

CID 1506558:    (NO_EFFECT)
Comparing an array to null is not useful: ""cannot get relocation section"", since the test will always evaluate as true.

5158 assert(Section && “cannot get relocation section”);
5159 Start = Section->getInputFileOffset();
5160 End = Start + Section->getSize();
5161 };
5162
5163 if (!DynamicRelocationsAddress && !PLTRelocationsAddress)
/bolt/lib/Rewrite/RewriteInstance.cpp: 5158 in llvm::bolt::RewriteInstance::patchELFAllocatableRelaSections<llvm::object::ELFType<(llvm::support::endianness)1, (bool)1>>(llvm::object::ELFObjectFile *)::[lambda(unsigned long, unsigned long &, unsigned long &) (instance 1)]::operator ()(unsigned long, unsigned long &, unsigned long &) const()
5152 uint64_t RelDynOffset = 0, RelDynEndOffset = 0;
5153 uint64_t RelPltOffset = 0, RelPltEndOffset = 0;
5154
5155 auto setSectionFileOffsets = [&](uint64_t Address, uint64_t &Start,
5156 uint64_t &End) {
5157 ErrorOr<BinarySection &> Section = BC->getSectionForAddress(Address);

CID 1506558:    (NO_EFFECT)
Comparing an array to null is not useful: ""cannot get relocation section"", since the test will always evaluate as true.

5158 assert(Section && “cannot get relocation section”);
5159 Start = Section->getInputFileOffset();
5160 End = Start + Section->getSize();
5161 };
5162
5163 if (!DynamicRelocationsAddress && !PLTRelocationsAddress)
/bolt/lib/Rewrite/RewriteInstance.cpp: 5158 in llvm::bolt::RewriteInstance::patchELFAllocatableRelaSections<llvm::object::ELFType<(llvm::support::endianness)0, (bool)0>>(llvm::object::ELFObjectFile *)::[lambda(unsigned long, unsigned long &, unsigned long &) (instance 1)]::operator ()(unsigned long, unsigned long &, unsigned long &) const()
5152 uint64_t RelDynOffset = 0, RelDynEndOffset = 0;
5153 uint64_t RelPltOffset = 0, RelPltEndOffset = 0;
5154
5155 auto setSectionFileOffsets = [&](uint64_t Address, uint64_t &Start,
5156 uint64_t &End) {
5157 ErrorOr<BinarySection &> Section = BC->getSectionForAddress(Address);

CID 1506558:    (NO_EFFECT)
Comparing an array to null is not useful: ""cannot get relocation section"", since the test will always evaluate as true.

5158 assert(Section && “cannot get relocation section”);
5159 Start = Section->getInputFileOffset();
5160 End = Start + Section->getSize();
5161 };
5162
5163 if (!DynamicRelocationsAddress && !PLTRelocationsAddress)
/bolt/lib/Rewrite/RewriteInstance.cpp: 5158 in llvm::bolt::RewriteInstance::patchELFAllocatableRelaSections<llvm::object::ELFType<(llvm::support::endianness)1, (bool)0>>(llvm::object::ELFObjectFile *)::[lambda(unsigned long, unsigned long &, unsigned long &) (instance 1)]::operator ()(unsigned long, unsigned long &, unsigned long &) const()
5152 uint64_t RelDynOffset = 0, RelDynEndOffset = 0;
5153 uint64_t RelPltOffset = 0, RelPltEndOffset = 0;
5154
5155 auto setSectionFileOffsets = [&](uint64_t Address, uint64_t &Start,
5156 uint64_t &End) {
5157 ErrorOr<BinarySection &> Section = BC->getSectionForAddress(Address);

CID 1506558:    (NO_EFFECT)
Comparing an array to null is not useful: ""cannot get relocation section"", since the test will always evaluate as true.

5158 assert(Section && “cannot get relocation section”);
5159 Start = Section->getInputFileOffset();
5160 End = Start + Section->getSize();
5161 };
5162
5163 if (!DynamicRelocationsAddress && !PLTRelocationsAddress)

** CID 1506557: Uninitialized variables (UNINIT)


*** CID 1506557: Uninitialized variables (UNINIT)
/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp: 988 in ::RISCVOperand::addFPImmOperands(llvm::MCInst &, unsigned int) const()
982 assert(N == 1 && “Invalid number of operands!”);
983 if (isImm()) {
984 addExpr(Inst, getImm(), isRV64Imm());
985 return;
986 }
987

CID 1506557:  Uninitialized variables  (UNINIT)
Using uninitialized value "<temporary>.U" when calling "~APFloat".

988 int Imm = RISCVLoadFPImm::getLoadFP64Imm(
989 APFloat(APFloat::IEEEdouble(), APInt(64, getFPConst())));
990 Inst.addOperand(MCOperand::createImm(Imm));
991 }
992
993 void addFenceArgOperands(MCInst &Inst, unsigned N) const {

** CID 1506556: Uninitialized variables (UNINIT)


*** CID 1506556: Uninitialized variables (UNINIT)
/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp: 499 in ::RISCVOperand::isLoadFPImm() const()
493 /// Return true if the operand is a valid fli.s floating-point immediate.
494 bool isLoadFPImm() const {
495 if (isImm())
496 return isUImm5();
497 if (Kind != KindTy::FPImmediate)
498 return false;

CID 1506556:  Uninitialized variables  (UNINIT)
Using uninitialized value "<temporary>.U" when calling "~APFloat".

499 int Idx = RISCVLoadFPImm::getLoadFP64Imm(
500 APFloat(APFloat::IEEEdouble(), APInt(64, getFPConst())));
501 // Don’t allow decimal version of the minimum value. It is a different value
502 // for each supported data type.
503 return Idx >= 0 && Idx != 1;
504 }


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