From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by sourceware.org (Postfix) with ESMTPS id 20AA83857C62 for ; Wed, 30 Sep 2020 06:22:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 20AA83857C62 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=saagarjha.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=saagarjha28@gmail.com Received: by mail-pl1-f196.google.com with SMTP id t18so380836plo.1 for ; Tue, 29 Sep 2020 23:22:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=YeQbkcukqqMxgrSwcdgu7q1g8HqKInj768fu2Lm/RtQ=; b=MBx+DICQIC8OxO0HyBqD8x+f7sw4QU5GdWT6jUIuThueRLKKhDEPr2Jcm1vxTyKyqf ah/QsyszGkmupwj3GVcKVAWrGHwEUO5hgfF3ruO725kdwCQ3I1W7IxpgPDLiYCzihbtA 9/Tk3YMXkpzKfbrM7Z3Mf6QOfqiZZLw+C2gjJjoDRus0GTtjSDOgzFygb8qu7EdEMrTK itjxvhFOzCNfvrmt5yDV4aq48lDu6k/ROFyORAlc2Onc43rQROhIzqdfvSTUyV7own3w t6g2skAsHzGB51De3mIjW03ExuAui7zNQxxugA6fQqi/V6oaaAgwFstG8Xip1FEQ721c 8vsQ== X-Gm-Message-State: AOAM531CNaHzQMY6uUHLHsYvk4mXZd7qfskD+E/ae2kNhzBXxEHrAlOw TFPK/rve/OTddcldCGVZ8D8= X-Google-Smtp-Source: ABdhPJxj8nubKCkZMc0io4XGmiuEHYFtvs+CYdGjVhkiDNxrUPRn2536LGEeP0Rul4PT2zI04W7izQ== X-Received: by 2002:a17:902:b604:b029:d3:7919:bb39 with SMTP id b4-20020a170902b604b02900d37919bb39mr508991pls.78.1601446931104; Tue, 29 Sep 2020 23:22:11 -0700 (PDT) Received: from localhost.localdomain (c-73-92-124-25.hsd1.ca.comcast.net. [73.92.124.25]) by smtp.gmail.com with ESMTPSA id i16sm1479058pjv.0.2020.09.29.23.22.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Sep 2020 23:22:10 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.0.3.2.33\)) Subject: Re: [PATCH] Fix a warning when initializing symbol_flags From: Saagar Jha In-Reply-To: <20200930061253.GF15011@bubble.grove.modra.org> Date: Tue, 29 Sep 2020 23:22:08 -0700 Cc: binutils@sourceware.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <20200926004224.35168-1-saagar@saagarjha.com> <20200926130656.GR5452@bubble.grove.modra.org> <40A73F70-3061-4094-AFEF-0A3337250B3C@saagarjha.com> <20200930061253.GF15011@bubble.grove.modra.org> To: Alan Modra X-Mailer: Apple Mail (2.3654.0.3.2.33) X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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:22:13 -0000 Actually, you just reminded me of one more way to do this, although = it=E2=80=99s a bit cryptic: static struct symbol_flags zero_flags; symbol_entry_t needle =3D { { zero_flags, hash, name, 0, 0, 0 } }; I had made a patch for this over the weekend but alas I forgot to send = it to the list. But if you=E2=80=99re fine with the zeroes, that=E2=80=99s= OK too. Saagar Jha > On Sep 29, 2020, at 23:12, Alan Modra wrote: >=20 > 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.=20 >=20 > 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. >=20 > * config/obj-elf.c (obj_elf_change_section): Rename variable to > avoid shadowing warning. > * symbols.c (symbol_entry_find): Init all symbol_flags fields. >=20 > 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 =3D { .X_op =3D O_constant }; > - symbol_set_value_expression (secsym, &expr); > + static const expressionS exp =3D { .X_op =3D 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 =3D htab_hash_string (name); > - symbol_entry_t needle =3D { { { 0 }, hash, name, 0, 0, 0 } }; > + symbol_entry_t needle =3D { { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, > + hash, name, 0, 0, 0 } }; > return htab_find_with_hash (table, &needle, hash); > } >=20 >=20 >=20 > --=20 > Alan Modra > Australia Development Lab, IBM