public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH obv] Initialize variables in i386_linux_handle_segmentation_fault
@ 2016-02-25 16:08 Simon Marchi
  2016-02-25 16:39 ` Tedeschi, Walfred
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Marchi @ 2016-02-25 16:08 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

FYI, I just pushed this as obvious.

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 dc12399..00af395 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
index 63cda45..42877da 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.5.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: [PATCH obv] Initialize variables in i386_linux_handle_segmentation_fault
  2016-02-25 16:08 [PATCH obv] Initialize variables in i386_linux_handle_segmentation_fault Simon Marchi
@ 2016-02-25 16:39 ` Tedeschi, Walfred
  0 siblings, 0 replies; 2+ messages in thread
From: Tedeschi, Walfred @ 2016-02-25 16:39 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

Thanks Simon,

Haven't seen that.

Regards,
-Fred

-----Original Message-----
From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-owner@sourceware.org] On Behalf Of Simon Marchi
Sent: Thursday, February 25, 2016 5:08 PM
To: gdb-patches@sourceware.org
Cc: Simon Marchi
Subject: [PATCH obv] Initialize variables in i386_linux_handle_segmentation_fault

FYI, I just pushed this as obvious.

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 dc12399..00af395 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index 63cda45..42877da 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.5.1

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-25 16:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-25 16:08 [PATCH obv] Initialize variables in i386_linux_handle_segmentation_fault Simon Marchi
2016-02-25 16:39 ` Tedeschi, Walfred

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).