[PATCH] D148813: [Coverity] Fix uninitialized scalar members

Akshay Khadse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 20 20:44:27 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG950e6979216a: [Coverity] Fix uninitialized scalar members (authored by akshaykhadse).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148813/new/

https://reviews.llvm.org/D148813

Files:
  llvm/include/llvm/InterfaceStub/IFSStub.h
  llvm/include/llvm/Object/ELFObjectFile.h
  llvm/include/llvm/Object/WindowsResource.h
  llvm/lib/ObjectYAML/XCOFFEmitter.cpp
  llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp


Index: llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
===================================================================
--- llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
+++ llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
@@ -127,7 +127,7 @@
   MCInst PrevInst;
   MCBoundaryAlignFragment *PendingBA = nullptr;
   std::pair<MCFragment *, size_t> PrevInstPosition;
-  bool CanPadInst;
+  bool CanPadInst = false;
 
   uint8_t determinePaddingPrefix(const MCInst &Inst) const;
   bool isMacroFused(const MCInst &Cmp, const MCInst &Jcc) const;
Index: llvm/lib/ObjectYAML/XCOFFEmitter.cpp
===================================================================
--- llvm/lib/ObjectYAML/XCOFFEmitter.cpp
+++ llvm/lib/ObjectYAML/XCOFFEmitter.cpp
@@ -70,7 +70,7 @@
   support::endian::Writer W;
   yaml::ErrorHandler ErrHandler;
   StringTableBuilder StrTblBuilder;
-  uint64_t StartOffset;
+  uint64_t StartOffset = 0u;
   // Map the section name to its corrresponding section index.
   DenseMap<StringRef, int16_t> SectionIndexMap = {
       {StringRef("N_DEBUG"), XCOFF::N_DEBUG},
Index: llvm/include/llvm/Object/WindowsResource.h
===================================================================
--- llvm/include/llvm/Object/WindowsResource.h
+++ llvm/include/llvm/Object/WindowsResource.h
@@ -234,7 +234,7 @@
   struct StringOrID {
     bool IsString;
     ArrayRef<UTF16> String;
-    uint32_t ID;
+    uint32_t ID = ~0u;
 
     StringOrID(uint32_t ID) : IsString(false), ID(ID) {}
     StringOrID(ArrayRef<UTF16> String) : IsString(true), String(String) {}
Index: llvm/include/llvm/Object/ELFObjectFile.h
===================================================================
--- llvm/include/llvm/Object/ELFObjectFile.h
+++ llvm/include/llvm/Object/ELFObjectFile.h
@@ -402,7 +402,7 @@
   // This flag is used for classof, to distinguish ELFObjectFile from
   // its subclass. If more subclasses will be created, this flag will
   // have to become an enum.
-  bool isDyldELFObject;
+  bool isDyldELFObject = false;
 
 public:
   ELFObjectFile(ELFObjectFile<ELFT> &&Other);
Index: llvm/include/llvm/InterfaceStub/IFSStub.h
===================================================================
--- llvm/include/llvm/InterfaceStub/IFSStub.h
+++ llvm/include/llvm/InterfaceStub/IFSStub.h
@@ -54,9 +54,9 @@
   explicit IFSSymbol(std::string SymbolName) : Name(std::move(SymbolName)) {}
   std::string Name;
   std::optional<uint64_t> Size;
-  IFSSymbolType Type;
-  bool Undefined;
-  bool Weak;
+  IFSSymbolType Type = IFSSymbolType::NoType;
+  bool Undefined = false;
+  bool Weak = false;
   std::optional<std::string> Warning;
   bool operator<(const IFSSymbol &RHS) const { return Name < RHS.Name; }
 };


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148813.515572.patch
Type: text/x-patch
Size: 2711 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230421/5a7fecdf/attachment.bin>


More information about the llvm-commits mailing list