From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by sourceware.org (Postfix) with ESMTPS id CEFC73857C62 for ; Wed, 30 Sep 2020 06:12:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org CEFC73857C62 Received: by mail-pl1-x643.google.com with SMTP id t18so368417plo.1 for ; Tue, 29 Sep 2020 23:12:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=yxS2+YyfRarqjGzQJxMFpAGheF3CtZiq7esQ8mLM54I=; b=QlRSx02fsQdB2ESUyXu9uuM0pcAqgB+QI+McAaFJkZmy6sUT626HG9bSOLekJzkqDf hfiCUVen5TfuS8hnWqPCxraNDUMcA9FUIWis59F15CqTXpxejOPxXycG+5M59ob7GY2R 4Ydm8skYJu13MOgHiu0ZyJfAy9Q3/s9XMOtmjzoYP3+sgDfsVDrS+ka/49D6XJYyOLV+ cmIaUaMT+4ThyTVY8Rx6hEwHq87QKzlSm2CAkzBxEYJXYbjQktEgReOem1TfhOQMaOJG L5yNxKQ5eTIUi4im2fZpOriO/W8ebNw4KFPlhJMF+OKa6SsSy681xVehBFUN7VuxqtFR EStg== X-Gm-Message-State: AOAM532x8UmRKGWs7SWUyJ2BgI4LIj956om9Vz94vJvwDk4n8NmkjCgB FZXq68ohLGt0hOxyGMjIAPA= X-Google-Smtp-Source: ABdhPJwUVQbaE1hmij7W+2DwvlSJJcojb+HKy3Cl6frEbzLSskSLULqEb/J2a5KZvwGIuuMNoYHPIQ== X-Received: by 2002:a17:90a:4d84:: with SMTP id m4mr1097048pjh.59.1601446377820; Tue, 29 Sep 2020 23:12:57 -0700 (PDT) Received: from bubble.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id o67sm759711pgo.8.2020.09.29.23.12.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 23:12:56 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 685DB85E08; Wed, 30 Sep 2020 15:42:53 +0930 (ACST) Date: Wed, 30 Sep 2020 15:42:53 +0930 From: Alan Modra To: Saagar Jha Cc: Hans-Peter Nilsson , binutils@sourceware.org Subject: Re: [PATCH] Fix a warning when initializing symbol_flags Message-ID: <20200930061253.GF15011@bubble.grove.modra.org> References: <20200926004224.35168-1-saagar@saagarjha.com> <20200926130656.GR5452@bubble.grove.modra.org> <40A73F70-3061-4094-AFEF-0A3337250B3C@saagarjha.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <40A73F70-3061-4094-AFEF-0A3337250B3C@saagarjha.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Sep 2020 06:13:00 -0000 On Sat, Sep 26, 2020 at 03:30:53PM -0700, Saagar Jha wrote: > Eleven zeroes is, as far as I can tell, the only widely-compatible, > guaranteed-to-work way to initialize this without warnings. Let's do that. I had reason today to compile binutils on an older system with gcc-4.4.7 installed, and that warned on the current source. * config/obj-elf.c (obj_elf_change_section): Rename variable to avoid shadowing warning. * symbols.c (symbol_entry_find): Init all symbol_flags fields. diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index b1c99020a3..cd457abe5e 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -762,8 +762,8 @@ obj_elf_change_section (const char *name, /* We could be repurposing an undefined symbol here: make sure we reset sy_value to look like other section symbols in order to avoid trying to incorrectly resolve this section symbol later on. */ - static const expressionS expr = { .X_op = O_constant }; - symbol_set_value_expression (secsym, &expr); + static const expressionS exp = { .X_op = O_constant }; + symbol_set_value_expression (secsym, &exp); symbol_set_bfdsym (secsym, sec->symbol); } else diff --git a/gas/symbols.c b/gas/symbols.c index d6080886be..26dd84b126 100644 --- a/gas/symbols.c +++ b/gas/symbols.c @@ -196,7 +196,8 @@ static void * symbol_entry_find (htab_t table, const char *name) { hashval_t hash = htab_hash_string (name); - symbol_entry_t needle = { { { 0 }, hash, name, 0, 0, 0 } }; + symbol_entry_t needle = { { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + hash, name, 0, 0, 0 } }; return htab_find_with_hash (table, &needle, hash); } -- Alan Modra Australia Development Lab, IBM