This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [FYI v3 5/8] Add support for the Rust language
- From: Tom Tromey <tom at tromey dot com>
- To: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- Cc: tom at tromey dot com (Tom Tromey), gdb-patches at sourceware dot org
- Date: Wed, 18 May 2016 10:17:22 -0600
- Subject: Re: [FYI v3 5/8] Add support for the Rust language
- Authentication-results: sourceware.org; auth=none
- References: <20160518134628 dot 6F08A1CB9 at oc7340732750 dot ibm dot com>
>>>>> "Ulrich" == Ulrich Weigand <uweigand@de.ibm.com> writes:
Ulrich> This causes a build failure on my RHEL5 daily build for SPU,
Ulrich> which uses a GCC 4.1 host compiler:
Ulrich> gdb/rust-lang.c: In function 'value* rust_subscript(expression*, int*,
Ulrich> noside, int)':
Ulrich> gdb/rust-lang.c:1311: warning: 'high' may be used uninitialized in this function
Could you try the appended? If it works for you I will check it in.
Tom
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b7a6351..073d482 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2016-05-18 Tom Tromey <tom@tromey.com>
+
+ * rust-lang.c (rust_subscript): Initialize "high".
+
2016-05-17 Tom Tromey <tom@tromey.com>
* std-operator.def (OP_RANGE): Rename from OP_F90_RANGE.
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index b8af166..5df99ce 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -1308,9 +1308,10 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside,
{
struct value *lhs, *rhs, *result;
struct type *rhstype;
- LONGEST low, high, high_bound;
+ LONGEST low, high_bound;
/* Initialized to appease the compiler. */
enum range_type kind = BOTH_BOUND_DEFAULT;
+ LONGEST high = 0;
int want_slice = 0;
++*pos;