This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[obv] DWARF-5: Fix compilation with GCC 4.4.7 [Re: [commit] [PATCH 3/6] DWARF-5 basic functionality]


On Mon, 27 Feb 2017 22:58:28 +0100, Maciej W. Rozycki wrote:
> cc1: warnings being treated as errors
> .../binutils/dwarf.c: In function 'display_debug_rnglists_list':
> .../binutils/dwarf.c:5876: error: 'begin' may be used uninitialized in this function
> .../binutils/dwarf.c:5876: error: 'end' may be used uninitialized in this function
> .../binutils/dwarf.c: In function 'display_loclists_list':
> .../binutils/dwarf.c:5014: error: 'begin' may be used uninitialized in this function
> .../binutils/dwarf.c:5015: error: 'end' may be used uninitialized in this function
> make[4]: *** [dwarf.o] Error 1
> 
> (with GCC 4.4.7 and "-g -O -fno-inline"); line numbers as per current 
> master.

Checked in as obvious.


Thanks,
Jan
--- Begin Message ---
binutils/
2017-02-27  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix compilation with GCC 4.4.7.
	* dwarf.c (display_loclists_list, display_debug_rnglists_list):
	Initialize begin and end.
---
 binutils/ChangeLog | 6 ++++++
 binutils/dwarf.c   | 8 +++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 4c78f79..21ae4af 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2017-02-27  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	Fix compilation with GCC 4.4.7.
+	* dwarf.c (display_loclists_list, display_debug_rnglists_list):
+	Initialize begin and end.
+
 2017-02-27  Rudy Y  <rudyy.id@gmail.com>
 
 	PR 20881
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 86a8385..ad0bfcf 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -5011,8 +5011,9 @@ display_loclists_list (struct dwarf_section *section,
   int dwarf_version;
   unsigned int bytes_read;
 
-  dwarf_vma begin;
-  dwarf_vma end;
+  /* Initialize it due to a false compiler warning.  */
+  dwarf_vma begin = -1;
+  dwarf_vma end = -1;
   dwarf_vma length;
   int need_frame_base;
 
@@ -5873,7 +5874,8 @@ display_debug_rnglists_list (unsigned char *start, unsigned char *finish,
     {
       unsigned long off = offset + (start - next);
       enum dwarf_range_list_entry rlet;
-      dwarf_vma begin, length, end;
+      /* Initialize it due to a false compiler warning.  */
+      dwarf_vma begin = -1, length, end = -1;
       unsigned int bytes_read;
 
       if (start + 1 > finish)
-- 
2.9.3

--- End Message ---

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]