From patchwork Sat May 16 14:39:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 6767 Received: (qmail 12105 invoked by alias); 16 May 2015 14:39:13 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 12092 invoked by uid 89); 16 May 2015 14:39:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Sat, 16 May 2015 14:39:12 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t4GEdArR009377 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sat, 16 May 2015 10:39:10 -0400 Received: from host1.jankratochvil.net (ovpn-116-27.ams2.redhat.com [10.36.116.27]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t4GEd6k8020897 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 16 May 2015 10:39:08 -0400 Date: Sat, 16 May 2015 16:39:05 +0200 From: Jan Kratochvil To: Patrick Palka Cc: Pedro Alves , gdb-patches@sourceware.org, Phil Muldoon Subject: [obv] [commit] [PATCH v5 6/7] compile: New 'compile print' Message-ID: <20150516143905.GA10110@host1.jankratochvil.net> References: <20150513201615.4051.5261.stgit@host1.jankratochvil.net> <20150513201704.4051.40784.stgit@host1.jankratochvil.net> <55562703.4060104@redhat.com> <20150516125814.GE9862@host1.jankratochvil.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes On Sat, 16 May 2015 16:24:53 +0200, Patrick Palka wrote: > GCC 4.9 emits -Wmaybe-uninitialized warnings for the function get_out_value_type(): Checked in as obvious, I did not test it with -O2. Thanks, Jan gdb/ChangeLog 2015-05-16 Jan Kratochvil * compile/compile-object-load.c (get_out_value_type): Fix uninitialized variable compiler warnings. --- gdb/ChangeLog | 5 +++++ gdb/compile/compile-object-load.c | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e5de834..500eae1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2015-05-16 Jan Kratochvil + * compile/compile-object-load.c (get_out_value_type): Fix uninitialized + variable compiler warnings. + +2015-05-16 Jan Kratochvil + * compile/compile-object-load.c (get_out_value_type): Fix returned type. 2015-05-16 Jan Kratochvil diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c index e2d8f2f..67bc69a 100644 --- a/gdb/compile/compile-object-load.c +++ b/gdb/compile/compile-object-load.c @@ -371,9 +371,12 @@ static struct type * get_out_value_type (struct symbol *func_sym, struct objfile *objfile, enum compile_i_scope_types scope) { - struct symbol *gdb_ptr_type_sym, *gdb_val_sym; + struct symbol *gdb_ptr_type_sym; + /* Initialize it just to avoid a GCC false warning. */ + struct symbol *gdb_val_sym = NULL; struct type *gdb_ptr_type, *gdb_type_from_ptr, *gdb_type, *retval; - const struct block *block; + /* Initialize it just to avoid a GCC false warning. */ + const struct block *block = NULL; const struct blockvector *bv; int nblocks = 0; int block_loop = 0; @@ -384,7 +387,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile, gdb_ptr_type_sym = NULL; for (block_loop = 0; block_loop < nblocks; block_loop++) { - struct symbol *function; + struct symbol *function = NULL; const struct block *function_block; block = BLOCKVECTOR_BLOCK (bv, block_loop);