aboutsummaryrefslogtreecommitdiff
path: root/gdb/stack.c
diff options
context:
space:
mode:
authorYao Qi <yao@codesourcery.com>2013-12-08 10:34:34 +0800
committerYao Qi <yao@codesourcery.com>2013-12-08 10:34:34 +0800
commite5e6f788e45ebdcf46c3a24f68994851186aa839 (patch)
tree2ba98ae5022d719bc35abff9e70af5d835b085e4 /gdb/stack.c
parent06fe43ca0ecf2cda7a7419bee2b5771d9d034f03 (diff)
downloadgdb-e5e6f788e45ebdcf46c3a24f68994851186aa839.zip
gdb-e5e6f788e45ebdcf46c3a24f68994851186aa839.tar.gz
gdb-e5e6f788e45ebdcf46c3a24f68994851186aa839.tar.bz2
Avoid "may be used uninitialized" warning
Hi, I see such warning below on one compiler I am using. cc1: warnings being treated as errors ../../workspace/gdb/stack.c: In function 'frame_info': ../../workspace/gdb/stack.c:1519:20: error: 'caller_pc' may be used uninitialized in this function Go through the gdb-patches archives and find the "canonical" way to fix this warning is to initialize the variable. gdb: 2013-12-08 Yao Qi <yao@codesourcery.com> * stack.c (frame_info): Initialize variable caller_pc.
Diffstat (limited to 'gdb/stack.c')
-rw-r--r--gdb/stack.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gdb/stack.c b/gdb/stack.c
index 848bcb0a..f45bb80 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -1407,7 +1407,8 @@ frame_info (char *addr_exp, int from_tty)
struct cleanup *back_to = make_cleanup (null_cleanup, NULL);
CORE_ADDR frame_pc;
int frame_pc_p;
- CORE_ADDR caller_pc;
+ /* Initialize it to avoid "may be used uninitialized" warning. */
+ CORE_ADDR caller_pc = 0;
volatile struct gdb_exception ex;
fi = parse_frame_specification_1 (addr_exp, "No stack.", &selected_frame_p);