From patchwork Fri Feb 24 12:57:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 19372 Received: (qmail 125594 invoked by alias); 24 Feb 2017 12:57:47 -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 125581 invoked by uid 89); 24 Feb 2017 12:57:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=UD:offset.sect_off, htab*, offset.sect_off, dwo_file* X-HELO: mail-wr0-f169.google.com Received: from mail-wr0-f169.google.com (HELO mail-wr0-f169.google.com) (209.85.128.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 24 Feb 2017 12:57:46 +0000 Received: by mail-wr0-f169.google.com with SMTP id 89so12530170wrr.3 for ; Fri, 24 Feb 2017 04:57:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=M8JX3IUERoV5j342iW6gx65PjFwKfSx+ikbiWmXmHyI=; b=CWAjXomQGpqSYMGO56Z0gT0eqtaGIZy4Dr4uQfeOB0Tg9h5MUnhnCaE8vTAP1dYANO BdcRz8o0iooeyiQ8QdrB0Q0VDCcv0xCNAIuz+y+wxcMsV6jlzfZn+mcRz1L+mTzEeN+5 VkG1PwPgEqtz8emDMe8OtTe4iKPyMuEg8VcAfgI1vRhZcwORYKGNUEQD0Kxb0fQyOJDv lkp0zF8PZGe9ebyJU0swpcBvC+6JMAQc4WE5JoWDrRKOHhg2wzwRKcDIaB63nm6x1FCX 7v3s9FRC8ArWFI21pXUMipxkbiFy8M6LunAtk3+OAOkAryDbN1fVuevsQTa+djTYZTRM WXkw== X-Gm-Message-State: AMke39lozXn9gEjElpnLl0bIBuocSA8UZrLMzaW9fMwDZIhSuqNPwOR2ya73sCxsfeHN1wcZ X-Received: by 10.223.160.14 with SMTP id k14mr2725391wrk.69.1487941064282; Fri, 24 Feb 2017 04:57:44 -0800 (PST) Received: from host1.jankratochvil.net (host1.jankratochvil.net. [2a02:2b88:2:1::3b57:1]) by smtp.gmail.com with ESMTPSA id g6sm2251809wmc.30.2017.02.24.04.57.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Feb 2017 04:57:43 -0800 (PST) From: Jan Kratochvil X-Google-Original-From: Jan Kratochvil Date: Fri, 24 Feb 2017 13:57:41 +0100 To: Andreas Arnez Cc: gdb-patches@sourceware.org, Victor Leschuk Subject: [patch] DWARF-5: Initialization due to a false compiler warning [Re: [PATCH v2 4/8] DWARF-5 basic functionality] Message-ID: <20170224125741.GA12955@host1.jankratochvil.net> References: <148753968011.4016.6818202131640662529.stgit@host1.jankratochvil.net> <148753970532.4016.14210350935498491454.stgit@host1.jankratochvil.net> <20170222142857.GA25383@host1.jankratochvil.net> <20170222183222.GA10292@host1.jankratochvil.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.1 (2016-10-04) Hi, I finally get the warnings: dwarf2read.c: In function ‘void create_debug_type_hash_table(dwo_file*, dwarf2_section_info*, htab*&, rcuh_kind)’: dwarf2read.c:4776:32: error: ‘header.comp_unit_head::type_offset_in_tu.cu_offset::cu_off’ may be used uninitialized in this function [-Werror=maybe-uninitialized] dwarf2read.c:4816:21: error: ‘header.comp_unit_head::signature’ may be used uninitialized in this function [-Werror=maybe-uninitialized] cc1plus: all warnings being treated as errors Even with system gcc-6.3.1-1.fc25.x86_64. I do not know why I had it unreproducible before. OK for check-in? Jan gdb/ChangeLog 2017-02-24 Jan Kratochvil * dwarf2read.c (create_debug_type_hash_table): Initialize header.signature and header.type_offset_in_tu. diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index f119750..40b99d9 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -4728,6 +4728,10 @@ create_debug_type_hash_table (struct dwo_file *dwo_file, offset.sect_off = ptr - section->buffer; + /* Initialize it due to a false compiler warning. */ + header.signature = -1; + header.type_offset_in_tu.cu_off = -1; + /* We need to read the type's signature in order to build the hash table, but we don't need anything else just yet. */