This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA] Fix uninitialised variable warning in ada-lang.c
- From: Matthew Gretton-Dann <matthew dot gretton-dann at arm dot com>
- To: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Thu, 31 May 2012 09:34:12 +0100
- Subject: [RFA] Fix uninitialised variable warning in ada-lang.c
All,
When building gdb at -O1 I get the following error from GCC:
.../ada-lang.c: In function ‘standard_lookup’:
.../ada-lang.c:4262: error: ‘sym’ may be used uninitialized in this function
The attached patch fixes this.
The issue does not appear at -O2 because the compiler has done some
inlining which shows that sym is never used uninitialized.
OK?
gdb/ChangeLog:
2012-05-31 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
* ada-lang.c (standard_lookup): Prevent uninitialized variable
warning.
--
Matthew Gretton-Dann
Principal Engineer, PD Software - Tools, ARM Ltd
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 1fac316..2f349e2 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -4256,7 +4256,7 @@ static struct symbol *
standard_lookup (const char *name, const struct block *block,
domain_enum domain)
{
- struct symbol *sym;
+ struct symbol *sym = NULL;
if (lookup_cached_symbol (name, domain, &sym, NULL))
return sym;