From patchwork Sat Jan 12 07:04:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Philippe Waroquiers X-Patchwork-Id: 31037 Received: (qmail 17740 invoked by alias); 12 Jan 2019 07:04:14 -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 17730 invoked by uid 89); 12 Jan 2019 07:04:14 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-27.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=HContent-Transfer-Encoding:8bit X-HELO: mailsec112.isp.belgacom.be Received: from mailsec112.isp.belgacom.be (HELO mailsec112.isp.belgacom.be) (195.238.20.108) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 12 Jan 2019 07:04:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skynet.be; i=@skynet.be; q=dns/txt; s=securemail; t=1547276652; x=1578812652; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=xwb+CH5UxCdEKjM/SEKNmJpnn0F+DwSNX1+owcDCReE=; b=u9vQf1Nvov3M8WAfz3lnW9g2dgi/y2+Z8c/PF3C+ato6d4SKOQYKw7Q3 pUJeDIR1u8U33kp28GFWE+hHv7DArA==; Received: from 184.205-67-87.adsl-dyn.isp.belgacom.be (HELO md.home) ([87.67.205.184]) by relay.skynet.be with ESMTP/TLS/DHE-RSA-AES128-GCM-SHA256; 12 Jan 2019 08:04:10 +0100 From: Philippe Waroquiers To: gdb-patches@sourceware.org Cc: Philippe Waroquiers Subject: [PUSHED/OBVIOUS] Fix 'obj' may be used uninitialized warning in symtab.c:matching_obj_sections. Date: Sat, 12 Jan 2019 08:04:03 +0100 Message-Id: <20190112070403.26830-1-philippe.waroquiers@skynet.be> MIME-Version: 1.0 X-IsSubscribed: yes Fix warning: gdb/symtab.c: In function ‘int matching_obj_sections(obj_section*, obj_section*)’: gdb/symtab.c:1024:12: warning: ‘obj’ may be used uninitialized in this function [-Wmaybe-uninitialized] if (obj->separate_debug_objfile_backlink != NULL 2019-01-12 Philippe Waroquiers * symtab.c (matching_obj_sections): Initialize obj, declare it closer to its usage. --- gdb/ChangeLog | 5 +++++ gdb/symtab.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7fd2051cb0..e0b47b4bb0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2019-01-12 Philippe Waroquiers + + * symtab.c (matching_obj_sections): Initialize obj, + declare it closer to its usage. + 2019-01-10 Tom Tromey * thread-iter.h (inf_threads_iterator): Use next_iterator. diff --git a/gdb/symtab.c b/gdb/symtab.c index d5e18a64d0..29b24328fb 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -970,7 +970,6 @@ matching_obj_sections (struct obj_section *obj_first, { asection *first = obj_first? obj_first->the_bfd_section : NULL; asection *second = obj_second? obj_second->the_bfd_section : NULL; - struct objfile *obj; /* If they're the same section, then they match. */ if (first == second) @@ -1010,6 +1009,7 @@ matching_obj_sections (struct obj_section *obj_first, /* Otherwise check that they are in corresponding objfiles. */ + struct objfile *obj = NULL; for (objfile *objfile : all_objfiles (current_program_space)) if (objfile->obfd == first->owner) {