Initialize variables in i386_linux_handle_segmentation_fault

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.
This commit is contained in:
Simon Marchi 2016-02-25 11:03:22 -05:00
parent 678b48b7cf
commit 166616ce00
2 changed files with 7 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2016-02-25 Simon Marchi <simon.marchi@ericsson.com>
* i386-linux-tdep.c (i386_linux_handle_segmentation_fault):
Initialize variables.
2016-02-25 Antoine Tremblay <antoine.tremblay@ericsson.com>
* ax-general.c (ax_reg): Call gdbarch_remote_register_number.

View file

@ -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;