diff options
author | Alan Modra <amodra@gmail.com> | 2024-04-09 08:53:35 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2024-04-17 09:24:36 +0930 |
commit | 59497587af9e1c5f029ab0bb106103dab30a5f5d (patch) | |
tree | 677fb2a56586cc0d5aeeb28311ec39153abfceaf /libctf/ctf-serialize.c | |
parent | 20bf7711bce2188c1af985a87df23c4653c2cc7a (diff) | |
download | binutils-59497587af9e1c5f029ab0bb106103dab30a5f5d.zip binutils-59497587af9e1c5f029ab0bb106103dab30a5f5d.tar.gz binutils-59497587af9e1c5f029ab0bb106103dab30a5f5d.tar.bz2 |
libctf warnings
Seen with every compiler I have if using -fno-inline:
home/alan/src/binutils-gdb/libctf/ctf-create.c: In function ‘ctf_add_encoded’:
/home/alan/src/binutils-gdb/libctf/ctf-create.c:555:3: warning: ‘encoding’ may be used uninitialized [-Wmaybe-uninitialized]
555 | memcpy (dtd->dtd_vlen, &encoding, sizeof (encoding));
Seen with gcc-4.9 and probably others at lower optimisation levels:
home/alan/src/binutils-gdb/libctf/ctf-serialize.c: In function 'symtypetab_density':
/home/alan/src/binutils-gdb/libctf/ctf-serialize.c:211:18: warning: 'sym' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (*max < sym->st_symidx)
Seen with gcc-4.5 and probably others at lower optimisation levels:
/home/alan/src/binutils-gdb/libctf/ctf-types.c:1649:21: warning: 'tp' may be used uninitialized in this function
/home/alan/src/binutils-gdb/libctf/ctf-link.c:765:16: warning: 'parent_i' may be used uninitialized in this function
Also with gcc-4.5:
In file included from /home/alan/src/binutils-gdb/libctf/ctf-endian.h:25:0,
from /home/alan/src/binutils-gdb/libctf/ctf-archive.c:24:
/home/alan/src/binutils-gdb/libctf/swap.h:70:0: warning: "_Static_assert" redefined
/usr/include/sys/cdefs.h:568:0: note: this is the location of the previous definition
* swap.h (_Static_assert): Don't define if already defined.
* ctf-serialize.c (symtypetab_density): Merge two
CTF_SYMTYPETAB_FORCE_INDEXED blocks.
* ctf-create.c (ctf_add_encoded): Avoid "encoding" may be used
uninitialized warning.
* ctf-link.c (ctf_link_deduplicating_open_inputs): Avoid
"parent_i" may be used uninitialized warning.
* ctf-types.c (ctf_type_rvisit): Avoid "tp" may be used
uninitialized warning.
Diffstat (limited to 'libctf/ctf-serialize.c')
-rw-r--r-- | libctf/ctf-serialize.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/libctf/ctf-serialize.c b/libctf/ctf-serialize.c index 8645f32..11cbe75 100644 --- a/libctf/ctf-serialize.c +++ b/libctf/ctf-serialize.c @@ -202,17 +202,15 @@ symtypetab_density (ctf_dict_t *fp, ctf_dict_t *symfp, ctf_dynhash_t *symhash, } ctf_dynhash_remove (linker_known, name); - } - *unpadsize += sizeof (uint32_t); - (*count)++; - if (!(flags & CTF_SYMTYPETAB_FORCE_INDEXED)) - { if (*max < sym->st_symidx) *max = sym->st_symidx; } else (*max)++; + + *unpadsize += sizeof (uint32_t); + (*count)++; } if (err != ECTF_NEXT_END) { |