public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Commit: Fix used before initialised warnings from Clang 16
@ 2023-06-30  9:45 Nick Clifton
  0 siblings, 0 replies; only message in thread
From: Nick Clifton @ 2023-06-30  9:45 UTC (permalink / raw)
  To: binutils

Hi Guys,

  I am applying the patch below to silence a few used-without-
  initialization warnings when compiling bfd/elf.c with Clang-16.

Cheers
  Nick

diff --git a/bfd/elf.c b/bfd/elf.c
index e506721222e..d38e0afff2e 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1904,6 +1904,8 @@ offset_from_vma (Elf_Internal_Phdr *phdrs, size_t phnum, bfd_vma vma,
 	return vma - seg->p_vaddr + seg->p_offset;
       }
 
+  if (max_size_p)
+    *max_size_p = 0;
   bfd_set_error (bfd_error_invalid_operation);
   return (file_ptr) -1;
 }
@@ -2001,8 +2003,8 @@ _bfd_elf_get_dynamic_symbols (bfd *abfd, Elf_Internal_Phdr *phdr,
   bfd_byte *versym = NULL;
   bfd_byte *verdef = NULL;
   bfd_byte *verneed = NULL;
-  size_t verdef_size;
-  size_t verneed_size;
+  size_t verdef_size = 0;
+  size_t verneed_size = 0;
   size_t extsym_size;
   const struct elf_backend_data *bed;
 


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-30  9:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-30  9:45 Commit: Fix used before initialised warnings from Clang 16 Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).