public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
From: Nick Clifton <nickc@sourceware.org>
To: bfd-cvs@sourceware.org
Subject: [binutils-gdb] Fix used-before-initialized warnings when compiling elf.c with Clang-16.
Date: Fri, 30 Jun 2023 09:45:42 +0000 (GMT)	[thread overview]
Message-ID: <20230630094542.D7F26385141E@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7e3ca9a4afcc4ff2960d12eaad35c75a7abb84e9

commit 7e3ca9a4afcc4ff2960d12eaad35c75a7abb84e9
Author: Nick Clifton <nickc@redhat.com>
Date:   Fri Jun 30 10:45:20 2023 +0100

    Fix used-before-initialized warnings when compiling elf.c with Clang-16.

Diff:
---
 bfd/elf.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

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;

                 reply	other threads:[~2023-06-30  9:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230630094542.D7F26385141E@sourceware.org \
    --to=nickc@sourceware.org \
    --cc=bfd-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).