public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] libctf: work around an uninitialized variable warning
@ 2023-03-24 14:08 Nick Alcock
  0 siblings, 0 replies; only message in thread
From: Nick Alcock @ 2023-03-24 14:08 UTC (permalink / raw)
  To: bfd-cvs, gdb-cvs

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

commit cce0bb8ff8a4922da4318a3654f68cfabb4c3ec8
Author: Nick Alcock <nick.alcock@oracle.com>
Date:   Mon Mar 13 17:32:53 2023 +0000

    libctf: work around an uninitialized variable warning
    
    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.

Diff:
---
 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;

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

only message in thread, other threads:[~2023-03-24 14:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-24 14:08 [binutils-gdb] libctf: work around an uninitialized variable warning Nick Alcock

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).