From 166616ce00e0c27fa3f556bcdeb908d4c0212393 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Thu, 25 Feb 2016 11:03:22 -0500 Subject: [PATCH] Initialize variables in i386_linux_handle_segmentation_fault MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit We see this error when building with gcc 4.3. ../../gdb/i386-linux-tdep.c: In function ‘i386_linux_handle_segmentation_fault’: ../../gdb/i386-linux-tdep.c:399: error: ‘access’ may be used uninitialized in this function ../../gdb/i386-linux-tdep.c:399: error: ‘upper_bound’ may be used uninitialized in this function ../../gdb/i386-linux-tdep.c:399: error: ‘lower_bound’ may be used uninitialized in this function It's a false positive, since the variables will always get initialized in the TRY clause, and the CATCH returns. gdb/ChangeLog: * i386-linux-tdep.c (i386_linux_handle_segmentation_fault): Initialize variables. --- gdb/ChangeLog | 5 +++++ gdb/i386-linux-tdep.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index dc123996c54..00af3950277 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2016-02-25 Simon Marchi + + * i386-linux-tdep.c (i386_linux_handle_segmentation_fault): + Initialize variables. + 2016-02-25 Antoine Tremblay * ax-general.c (ax_reg): Call gdbarch_remote_register_number. diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index 63cda45d608..42877dab410 100644 --- a/gdb/i386-linux-tdep.c +++ b/gdb/i386-linux-tdep.c @@ -396,7 +396,8 @@ void i386_linux_handle_segmentation_fault (struct gdbarch *gdbarch, struct ui_out *uiout) { - CORE_ADDR lower_bound, upper_bound, access; + /* -Wmaybe-uninitialized */ + CORE_ADDR lower_bound = 0, upper_bound = 0, access = 0; int is_upper; long sig_code = 0; -- 2.30.2