From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 60993 invoked by alias); 25 Feb 2016 16:08:00 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 60983 invoked by uid 89); 25 Feb 2016 16:07:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy=3967, 3968, 396,8, HContent-Transfer-Encoding:8bit X-HELO: usplmg20.ericsson.net Received: from usplmg20.ericsson.net (HELO usplmg20.ericsson.net) (198.24.6.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 25 Feb 2016 16:07:55 +0000 Received: from EUSAAHC008.ericsson.se (Unknown_Domain [147.117.188.96]) by usplmg20.ericsson.net (Symantec Mail Security) with SMTP id EE.72.12433.0A22FC65; Thu, 25 Feb 2016 16:49:52 +0100 (CET) Received: from elxcz23q12-y4.dyn.mo.ca.am.ericsson.se (147.117.188.8) by smtps-am.internal.ericsson.com (147.117.188.96) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 25 Feb 2016 11:07:52 -0500 From: Simon Marchi To: CC: Simon Marchi Subject: [PATCH obv] Initialize variables in i386_linux_handle_segmentation_fault Date: Thu, 25 Feb 2016 16:08:00 -0000 Message-ID: <1456416469-16334-1-git-send-email-simon.marchi@ericsson.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2016-02/txt/msg00803.txt.bz2 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 + + * 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 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