aboutsummaryrefslogtreecommitdiff
path: root/libctf
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2023-03-13 17:32:53 +0000
committerNick Alcock <nick.alcock@oracle.com>2023-03-24 13:37:32 +0000
commitcce0bb8ff8a4922da4318a3654f68cfabb4c3ec8 (patch)
tree50d669a4370fded21ddefcfb19370377890c6640 /libctf
parentca96e367f057c068fb9f016dd7beba55d5d29d81 (diff)
downloadgdb-cce0bb8ff8a4922da4318a3654f68cfabb4c3ec8.zip
gdb-cce0bb8ff8a4922da4318a3654f68cfabb4c3ec8.tar.gz
gdb-cce0bb8ff8a4922da4318a3654f68cfabb4c3ec8.tar.bz2
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.
Diffstat (limited to 'libctf')
-rw-r--r--libctf/ctf-lookup.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libctf/ctf-lookup.c b/libctf/ctf-lookup.c
index 10ababf..950c0a8 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;