From: Matthew Gretton-Dann <matthew.gretton-dann@linaro.org>
To: gdb-patches@sourceware.org
Cc: Patch Tracking <patches@linaro.org>
Subject: [RFA] Fix uninitialised variable warning error in gdb/stack.c
Date: Fri, 08 Feb 2013 12:10:00 -0000 [thread overview]
Message-ID: <5114EB2A.9040007@linaro.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 940 bytes --]
All,
When compiling GDB with GCC 4.5 and earlier I am getting the following
uninitialized variable warning:
/work/sources/gdb/stack.c: In function 'return_command':
/work/sources/gdb/stack.c:2281: error: 'rv_conv' may be used uninitialized
in this function
make[1]: *** [stack.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory `/work/builds/common/gdb'
The attached patch fixes this issue by initializing rv_conv when it is
declared. The value used to initialise rv_conv is chosen so that if the
code changes in the future and rv_conv really should be uninitialized then
the gdb_assert around line 2385 will trigger.
OK for trunk? Tested on x86_64-none-linux-gnu
gdb/ChangeLog:
2013-02-08 Matthew Gretton-Dann <matthew.gretton-dann@linaro.org>
* stack.c (return_command): Work around uninitialized variable
warning.
Thanks,
Matt
--
Matthew Gretton-Dann
Toolchain Working Group, Linaro
[-- Attachment #2: gdb-stack-c-uninit.txt --]
[-- Type: text/plain, Size: 492 bytes --]
diff --git a/gdb/stack.c b/gdb/stack.c
index 9f4aafc..147d815 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -2278,7 +2278,8 @@ down_command (char *count_exp, int from_tty)
void
return_command (char *retval_exp, int from_tty)
{
- enum return_value_convention rv_conv;
+ /* Initialize it just to avoid a GCC false warning. */
+ enum return_value_convention rv_conv = RETURN_VALUE_STRUCT_CONVENTION;
struct frame_info *thisframe;
struct gdbarch *gdbarch;
struct symbol *thisfun;
next reply other threads:[~2013-02-08 12:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-08 12:10 Matthew Gretton-Dann [this message]
2013-02-08 12:53 ` Pierre Muller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5114EB2A.9040007@linaro.org \
--to=matthew.gretton-dann@linaro.org \
--cc=gdb-patches@sourceware.org \
--cc=patches@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox