dwarf.c (process_abbrev_set): Properly parenthesize, fix fallout
authorHans-Peter Nilsson <hp@axis.com>
Tue, 11 May 2021 14:12:24 +0000 (16:12 +0200)
committerHans-Peter Nilsson <hp@bitrange.com>
Tue, 11 May 2021 14:26:30 +0000 (16:26 +0200)
Building as ILP32 shows:

 gcc -m32 -DHAVE_CONFIG_H -I. -I/checkout/binutils  -I. -I/checkout/binutils -I../bfd -I/checkout/binutils/../bfd -I/checkout/binutils/../include -DLOCALEDIR="\"/usr/local/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Werror -I/checkout/binutils/../zlib -g -O2   -MT dwarf.o -MD -MP -MF $depbase.Tpo -c -o dwarf.o /checkout/binutils/dwarf.c &&\
 mv -f $depbase.Tpo $depbase.Po
 In file included from /checkout/binutils/sysdep.h:101:0,
                  from /checkout/binutils/dwarf.c:21:
 /checkout/binutils/dwarf.c: In function 'process_abbrev_set':
 /checkout/binutils/dwarf.c:1072:15: error: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'dwarf_vma {aka long long unsigned int}' [-Werror=format=]
        warn (_("Debug info is corrupted, abbrev size (%lx) is larger than "
                ^
 /checkout/binutils/dwarf.c:1072:13: note: in expansion of macro '_'
        warn (_("Debug info is corrupted, abbrev size (%lx) is larger than "
              ^
 cc1: all warnings being treated as errors
 Makefile:1101: recipe for target 'dwarf.o' failed

The recent commit, casting one of the terms, has an obvious
typo.  To wit, the (non-cast) term abbrev_size is a
dwarf_vma and causes the whole expression to (still) be 64
bits.

binutils:
* dwarf.c (process_abbrev_set): Properly parenthesize before
casting to unsigned long.

binutils/ChangeLog
binutils/dwarf.c

index 6703b16b2b0c1e322f3233e6f011d6169fdfac4c..242563ed3a5332acecd9c5656b100e6eb3ad85af 100644 (file)
@@ -1,3 +1,8 @@
+2021-05-11  Hans-Peter Nilsson  <hp@axis.com>
+
+       * dwarf.c (process_abbrev_set): Properly parenthesize before
+       casting to unsigned long.
+
 2021-05-11  Alan Modra  <amodra@gmail.com>
 
        PR 27845
index aa48f69bbd45e891678bd30bd2726eb02c3e3171..8bc0acb270c2c2025553f0ac2896b86ac4865256 100644 (file)
@@ -1071,7 +1071,7 @@ process_abbrev_set (struct dwarf_section *section,
       /* PR 17531: file:4bcd9ce9.  */
       warn (_("Debug info is corrupted, abbrev size (%lx) is larger than "
              "abbrev section size (%lx)\n"),
-             (unsigned long) abbrev_base + abbrev_size,
+             (unsigned long) (abbrev_base + abbrev_size),
              (unsigned long) section->size);
       return NULL;
     }
This page took 0.029742 seconds and 4 git commands to generate.