This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Committed, binutils: dwarf.c (display_debug_names): Initialize hash_prev.
- From: Hans-Peter Nilsson <hp at bitrange dot com>
- To: binutils at sourceware dot org
- Date: Tue, 18 Jul 2017 06:17:01 -0400 (EDT)
- Subject: Committed, binutils: dwarf.c (display_debug_names): Initialize hash_prev.
- Authentication-results: sourceware.org; auth=none
Trying to build (for mmix-knuth-mmixware but I don't think that
matters) with an oldish gcc (4.3.0):
gcc -DHAVE_CONFIG_H -I. -I/home/hp/binutils/src/binutils -I. -I/home/hp/binutils/src/binutils -I../bfd -I/home/hp/binutils/src/binutils/../bfd -I/home/hp/binutils/src/binutils/../include -DLOCALEDIR="\"/usr/local/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -I/home/hp/binutils/src/binutils/../zlib -g -O2 -MT dwarf.o -MD -MP -MF .deps/dwarf.Tpo -c -o dwarf.o /home/hp/binutils/src/binutils/dwarf.c
cc1: warnings being treated as errors
/home/hp/binutils/src/binutils/dwarf.c: In function 'display_debug_names':
/home/hp/binutils/src/binutils/dwarf.c:7819: error: 'hash_prev' may be used uninitialized in this function
make[4]: *** [dwarf.o] Error 1
make[4]: Leaving directory `/home/hp/binutils/obj/m/binutils'
It takes a look and a half at the code to understand that it's false.
Committed as obvious.
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index f1400dc..d365736 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,7 @@
+2017-07-18 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * dwarf.c (display_debug_names): Initialize hash_prev.
+
2017-07-17 Nick Clifton <nickc@redhat.com>
PR 21433
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 5f8922e..f6fa157 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -7816,7 +7816,7 @@ display_debug_names (struct dwarf_section *section, void *file)
printf (_("Used %zu of %lu buckets.\n"), buckets_filled,
(unsigned long) bucket_count);
- uint32_t hash_prev;
+ uint32_t hash_prev = 0;
size_t hash_clash_count = 0;
size_t longest_clash = 0;
size_t this_length = 0;
brgds, H-P