From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [80.241.56.172]) by sourceware.org (Postfix) with ESMTPS id 563E13856DF5 for ; Thu, 5 May 2022 12:58:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 563E13856DF5 Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4KvDJt3vX7z9spp; Thu, 5 May 2022 14:58:22 +0200 (CEST) Date: Thu, 05 May 2022 14:58:15 +0200 From: Iain Buclaw Subject: Re: [PATCH] Use more ARRAY_SIZE. To: gcc-patches@gcc.gnu.org, Martin =?iso-8859-2?b?TGm5a2E=?= References: In-Reply-To: MIME-Version: 1.0 Message-Id: <1651754853.85hnr42bjs.astroid@pulse.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 May 2022 12:58:26 -0000 Excerpts from Martin Li=C5=A1ka's message of Mai 5, 2022 2:16 pm: > Patch can bootstrap on x86_64-linux-gnu and survives regression tests. >=20 > Ready to be installed? > Thanks, > Martin >=20 > gcc/d/ChangeLog: >=20 > * longdouble.h: Use ARRAY_SIZE. >=20 > diff --git a/gcc/d/longdouble.h b/gcc/d/longdouble.h > index 1e457ae04d6..2d9695a4309 100644 > --- a/gcc/d/longdouble.h > +++ b/gcc/d/longdouble.h > @@ -117,7 +117,7 @@ public: > private: > /* Including gcc/real.h presents too many problems, so just > statically allocate enough space for REAL_VALUE_TYPE. */ > - long realvalue[(2 + (16 + sizeof (long)) / sizeof (long))]; > + long realvalue[(2 + (16 + ARRAY_SIZE (long))]; > }; > =20 > /* Declared, but "volatile" is not required. */ >=20 Hi, This D front-end change doesn't look right to me, besides the slight difference in parentheses meaning the calculation would be off by some measure - (2 + (16 + N) / N) =3D> 7 vs. (2 + 16 + N) =3D> 22 - if I understand the ARRAY_SIZE macro correctly, it wouldn't even generate valid code either. Regards, Iain.