Work around a GCC uninitialized warning bug
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 8 Apr 2015 16:25:08 +0000 (09:25 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 8 Apr 2015 16:27:27 +0000 (09:27 -0700)
* compress.c (bfd_compress_section_contents): Work around a GCC
uninitialized warning bug fixed in GCC 4.7.

bfd/ChangeLog
bfd/compress.c

index 68e13c5..c7050af 100644 (file)
@@ -1,5 +1,10 @@
 2015-04-08  H.J. Lu  <hongjiu.lu@intel.com>
 
+       * compress.c (bfd_compress_section_contents): Work around a GCC
+       uninitialized warning bug fixed in GCC 4.7.
+
+2015-04-08  H.J. Lu  <hongjiu.lu@intel.com>
+
        * archive.c (_bfd_get_elt_at_filepos): Also copy BFD_COMPRESS_GABI
        bit.
        * bfd.c (bfd::flags): Increase size to 18 bits.
index ba9fc96..17b24e8 100644 (file)
@@ -79,7 +79,12 @@ bfd_compress_section_contents (bfd *abfd, sec_ptr sec,
   bfd_byte *buffer;
   bfd_size_type buffer_size;
   bfd_boolean decompress;
+#if defined(__GNUC__) && GCC_VERSION < 4007
+  /* Work around a GCC uninitialized warning bug fixed in GCC 4.7.  */
+  int zlib_size = 0;
+#else
   int zlib_size;
+#endif
   int orig_compression_header_size;
   int compression_header_size
     = bfd_get_compression_header_size (abfd, NULL);