public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: binutils@sourceware.org
Cc: Andrew Burgess <aburgess@redhat.com>
Subject: [PUSHED] opcodes/arm: silence compiler warning about uninitialized variable use
Date: Fri,  4 Nov 2022 11:01:32 +0000	[thread overview]
Message-ID: <20221104110132.694984-1-aburgess@redhat.com> (raw)
In-Reply-To: <20221101111802.1532080-1-aburgess@redhat.com>

*sigh*

Off-list, I was pointed at yet another uninitialized variable problem
caused by my disassembler styling patch.  This one is the same as the
first fix I pushed, just in another function.

Hopefully /this/ will be the last fix I end up pushing.

Thanks for your continued patience,

Andrew

---

After this commit:

  commit 6576bffe6cbbb53c5756b2fccd2593ba69b74cdf
  Date:   Thu Jul 7 13:43:45 2022 +0100

      opcodes/arm: add disassembler styling for arm

Some people were seeing their builds failing with complaints about a
possible uninitialized variable usage.  I previously fixed an instance
of this issue in this commit:

  commit 2df82cd4b459fbc32120e0ad1ce19e26349506fe
  Date:   Tue Nov 1 10:36:59 2022 +0000

      opcodes/arm: silence compiler warning about uninitialized variable use

which did fix the build problems that the sourceware buildbot was
hitting, however, an additional instance of the same problem was
brought to my attention, and that is fixed in this commit.

Where commit 2df82cd4b4 fixed the uninitialized variable problem in
print_mve_unpredictable, this commit fixes the same problem in
print_mve_undefined.

As with the previous commit, I don't believe we could really ever get
an uninitialized variable usage, based on the current usage of the
function, so I have just initialized the reason variable to "??".
---
 opcodes/arm-dis.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c
index 31ed81f5a4e..47a0a38adec 100644
--- a/opcodes/arm-dis.c
+++ b/opcodes/arm-dis.c
@@ -7148,7 +7148,9 @@ print_mve_undefined (struct disassemble_info *info,
 {
   void *stream = info->stream;
   fprintf_styled_ftype func = info->fprintf_styled_func;
-  const char *reason;
+  /* Initialize REASON to avoid compiler warning about uninitialized
+     usage, though such usage should be impossible.  */
+  const char *reason = "??";
 
   switch (undefined_code)
     {
-- 
2.25.4


      reply	other threads:[~2022-11-04 11:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-01 10:57 Andrew Burgess
2022-11-01 11:18 ` [PUSHED] opcodes/arm: don't pass non-string literal to printf like function Andrew Burgess
2022-11-04 11:01   ` Andrew Burgess [this message]

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=20221104110132.694984-1-aburgess@redhat.com \
    --to=aburgess@redhat.com \
    --cc=binutils@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).