[commit] ada-typeprint.c (print_range): Initialize lo,hi for gcc -Wall.

Message ID yjt2k365enf2.fsf@ruffy2.mtv.corp.google.com
State Committed
Headers

Commit Message

Doug Evans Aug. 18, 2014, 5:08 p.m. UTC
  Hi.

Just the standard tweak to cope with gcc -Wall.

../../clang/gdb/ada-typeprint.c: In function 'print_range':
../../clang/gdb/ada-typeprint.c:187:23: error: 'hi' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      ada_print_scalar (target_type, hi, stream);
                       ^
../../clang/gdb/ada-typeprint.c:185:23: error: 'lo' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      ada_print_scalar (target_type, lo, stream);
                       ^
cc1: all warnings being treated as errors


2014-08-18  Doug Evans  <dje@google.com>

	* ada-typeprint.c (print_range): Initialize lo,hi for gcc -Wall.
  

Comments

Joel Brobecker Aug. 18, 2014, 5:40 p.m. UTC | #1
> 2014-08-18  Doug Evans  <dje@google.com>
> 
> 	* ada-typeprint.c (print_range): Initialize lo,hi for gcc -Wall.

Argh, thanks!
  

Patch

diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c
index 57c8d93..27bd1d1 100644
--- a/gdb/ada-typeprint.c
+++ b/gdb/ada-typeprint.c
@@ -160,7 +160,7 @@  print_range (struct type *type, struct ui_file *stream,
       {
 	struct type *target_type;
 	volatile struct gdb_exception e;
-	LONGEST lo, hi;
+	LONGEST lo = 0, hi = 0; /* init for gcc -Wall */
 
 	target_type = TYPE_TARGET_TYPE (type);
 	if (target_type == NULL)