From: Nick Alcock <nick.alcock@oracle.com>
To: binutils@sourceware.org
Subject: [PATCH 2/4] libctf: work around an uninitialized variable warning
Date: Fri, 24 Mar 2023 13:36:23 +0000 [thread overview]
Message-ID: <20230324133625.450723-2-nick.alcock@oracle.com> (raw)
In-Reply-To: <20230324133625.450723-1-nick.alcock@oracle.com>
GCC 11+ complains that sym is uninitialized in ctf_symbol_next. It
isn't, but it's not quite smart enough to figure that out (it requires
domain-specific knowledge of the state of the ctf_next_t iterator
over multiple calls).
libctf/
* ctf-lookup.c (ctf_symbol_next): Initialize sym to a suitable
value for returning if never reset during the function.
---
libctf/ctf-lookup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libctf/ctf-lookup.c b/libctf/ctf-lookup.c
index 10ababf1489..950c0a809ac 100644
--- a/libctf/ctf-lookup.c
+++ b/libctf/ctf-lookup.c
@@ -651,7 +651,7 @@ ctf_id_t
ctf_symbol_next (ctf_dict_t *fp, ctf_next_t **it, const char **name,
int functions)
{
- ctf_id_t sym;
+ ctf_id_t sym = CTF_ERR;
ctf_next_t *i = *it;
int err;
--
2.39.1.268.g9de2f9a303
next prev parent reply other threads:[~2023-03-24 13:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-24 13:36 [PATCH 1/4] libctf: fix assertion failure with no system qsort_r Nick Alcock
2023-03-24 13:36 ` Nick Alcock [this message]
2023-03-24 13:36 ` [PATCH 3/4] libctf: fix a comment typo Nick Alcock
2023-03-24 13:36 ` [PATCH 4/4] libctf: get the offsets of fields of unnamed structs/unions right Nick Alcock
2023-03-25 6:07 ` Alan Modra
2023-03-27 10:27 ` Nick Alcock
2023-03-27 11:22 ` Alan Modra
2023-03-27 12:38 ` Nick Alcock
2023-04-06 11:46 ` Nick Alcock
2023-04-08 15:50 ` Nick Alcock
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=20230324133625.450723-2-nick.alcock@oracle.com \
--to=nick.alcock@oracle.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).