Can gold be compiled with gcc 3.4?

H.J. Lu hongjiu.lu@intel.com
Tue Nov 3 18:00:00 GMT 2009


Can gold be compiled with gcc 3.4?  I got

/net/gnu-6/export/gnu/import/git/binutils/gold/dwarf_reader.cc: In
function `int64_t gold::read_signed_LEB_128(const unsigned char*,
size_t*)':
/net/gnu-6/export/gnu/import/git/binutils/gold/dwarf_reader.cc:78:
warning: 'byte' might be used uninitialized in this function

with gcc 3.4.  After applying this patch, one gold test doesn't finish
after several minutes:

17950 pts/0    S      0:00 g++ -W -Wall -Werror -D_LARGEFILE_SOURCE -D_FILE_OFFS
17951 pts/0    S      0:00 /usr/libexec/gcc/x86_64-redhat-linux/3.4.6/collect2 -
17953 pts/0    R      7:19 gcctestdir1/ld --eh-frame-hdr -m elf_x86_64 -dynamic-


Thanks.


H.J.
---
2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>

	* dwarf_reader.cc (read_signed_LEB_128): Silence gcc 3.4.

diff --git a/gold/dwarf_reader.cc b/gold/dwarf_reader.cc
index d142586..9594cc7 100644
--- a/gold/dwarf_reader.cc
+++ b/gold/dwarf_reader.cc
@@ -75,7 +75,7 @@ read_signed_LEB_128(const unsigned char* buffer, size_t* len)
   int64_t result = 0;
   int shift = 0;
   size_t num_read = 0;
-  unsigned char byte;
+  unsigned char byte = 0;
 
   do
     {



More information about the Binutils mailing list