aboutsummaryrefslogtreecommitdiff
path: root/libctf/ctf-dump.c
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2021-03-02 15:10:05 +0000
committerNick Alcock <nick.alcock@oracle.com>2021-03-02 15:10:08 +0000
commitcf6a0b989a57db81f1470560edf4dbfb1835c032 (patch)
tree0e6b4836d3d148c59915e7631f32a0785bc8fd74 /libctf/ctf-dump.c
parent4659554b280bee894d117360f403d4073edd3bc9 (diff)
downloadgdb-cf6a0b989a57db81f1470560edf4dbfb1835c032.zip
gdb-cf6a0b989a57db81f1470560edf4dbfb1835c032.tar.gz
gdb-cf6a0b989a57db81f1470560edf4dbfb1835c032.tar.bz2
libctf: fix signed/unsigned comparison confusion
Comparing an encoding's cte_bits to a ctf_type_size needs a cast: one is a uint32_t and the other is an ssize_t. libctf/ChangeLog 2021-03-02 Nick Alcock <nick.alcock@oracle.com> * ctf-dump.c (ctf_dump_format_type): Fix signed/unsigned confusion.
Diffstat (limited to 'libctf/ctf-dump.c')
-rw-r--r--libctf/ctf-dump.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libctf/ctf-dump.c b/libctf/ctf-dump.c
index 758d28d..788355d 100644
--- a/libctf/ctf-dump.c
+++ b/libctf/ctf-dump.c
@@ -144,7 +144,7 @@ ctf_dump_format_type (ctf_dict_t *fp, ctf_id_t id, int flag)
if (ctf_type_encoding (fp, id, &ep) == 0)
{
- if (ep.cte_bits != ctf_type_size (fp, id) * CHAR_BIT
+ if ((ssize_t) ep.cte_bits != ctf_type_size (fp, id) * CHAR_BIT
&& flag & CTF_FT_BITFIELD)
{
if (asprintf (&bit, ":%i", ep.cte_bits) < 0)
@@ -154,7 +154,7 @@ ctf_dump_format_type (ctf_dict_t *fp, ctf_id_t id, int flag)
bit = NULL;
}
- if (ep.cte_bits != ctf_type_size (fp, id) * CHAR_BIT
+ if ((ssize_t) ep.cte_bits != ctf_type_size (fp, id) * CHAR_BIT
|| ep.cte_offset != 0)
{
const char *slice = "";