This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] compile: Fix uninitialized variable compiler warnings
- From: Jan Kratochvil <jkratoch at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 16 May 2015 14:38:37 -0000
- Subject: [binutils-gdb] compile: Fix uninitialized variable compiler warnings
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d976bace1c68aed43311651c1033c23b3c983094
commit d976bace1c68aed43311651c1033c23b3c983094
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Sat May 16 16:36:44 2015 +0200
compile: Fix uninitialized variable compiler warnings
gdb/ChangeLog
2015-05-16 Jan Kratochvil <jan.kratochvil@redhat.com>
* compile/compile-object-load.c (get_out_value_type): Fix uninitialized
variable compiler warnings.
Diff:
---
gdb/ChangeLog | 5 +++++
gdb/compile/compile-object-load.c | 9 ++++++---
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e5de834..500eae1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2015-05-16 Jan Kratochvil <jan.kratochvil@redhat.com>
+ * compile/compile-object-load.c (get_out_value_type): Fix uninitialized
+ variable compiler warnings.
+
+2015-05-16 Jan Kratochvil <jan.kratochvil@redhat.com>
+
* compile/compile-object-load.c (get_out_value_type): Fix returned type.
2015-05-16 Jan Kratochvil <jan.kratochvil@redhat.com>
diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c
index e2d8f2f..67bc69a 100644
--- a/gdb/compile/compile-object-load.c
+++ b/gdb/compile/compile-object-load.c
@@ -371,9 +371,12 @@ static struct type *
get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
enum compile_i_scope_types scope)
{
- struct symbol *gdb_ptr_type_sym, *gdb_val_sym;
+ struct symbol *gdb_ptr_type_sym;
+ /* Initialize it just to avoid a GCC false warning. */
+ struct symbol *gdb_val_sym = NULL;
struct type *gdb_ptr_type, *gdb_type_from_ptr, *gdb_type, *retval;
- const struct block *block;
+ /* Initialize it just to avoid a GCC false warning. */
+ const struct block *block = NULL;
const struct blockvector *bv;
int nblocks = 0;
int block_loop = 0;
@@ -384,7 +387,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
gdb_ptr_type_sym = NULL;
for (block_loop = 0; block_loop < nblocks; block_loop++)
{
- struct symbol *function;
+ struct symbol *function = NULL;
const struct block *function_block;
block = BLOCKVECTOR_BLOCK (bv, block_loop);