From owner-dev-commits-src-branches@freebsd.org Sat Jun 26 15:30:25 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A78F76555E5 for ; Sat, 26 Jun 2021 15:30:25 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic312-23.consmr.mail.gq1.yahoo.com (sonic312-23.consmr.mail.gq1.yahoo.com [98.137.69.204]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4GByVn2qpwz4ryb for ; Sat, 26 Jun 2021 15:30:25 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1624721424; bh=SQPZIwzayc4la3lWBZ8ebTmoWfkB8lDLR0HOmMowr2g=; h=X-Sonic-MF:Subject:From:Date:To:From:Subject; b=GO5svVjFWAsHrTtMvFSaL8zz6v8qzmZSEtARtU7zsPHVbQCAn21mXKitg9by1tp/3Vmev8U9U8PC4Mw+R4aKsrbiCxiB86LoiXD55ZKWSm3zIMfx+ls0SVki73RQREhS+YhS/5cMwyGBHpO7s5uwjsOXO50vf9NnrFJt9h1JctR1c5P2UkBl2ufx5XoiJfY0SGDusx2R+cpN/ddZb2jcYubgMtc2Bg1epzNGaXsfW3syT+WHkrqezwT+BMynzfg1Gh7ppMiZKsAnAiCWfNuxYD4Yx4IHKk4Tc/Zf2YpwNOBHzf54v55inJt2PWXWfWlFrxwkkLw1hQ0aYMydSrMYAQ== X-YMail-OSG: m80T778VM1kowx7XjwDD4PnP2A9taluCmhjRfeKK3nWCVxpxNnK0Pj2.W.Dt6Pa BfBy5ORsmhPjE5e9Qyq0PYg2M3c0WqVB0UAiwzg2jHV14KNxZ9cvZD4AXGqE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V3hH2izMLMLvmrJWx2.eUqUVhEiCuRCK_rrKRE0b0bVOz7QfwylINENy5KBX4RfQ_6sf83o_8Ls IOMs8VgYgE_ISR3muSJBn5ym_W2dyaRidmYcVqtFiMbsUGWJ.3FvbIPIA_iHF8Wiy8cvZ_9yNMkA FE.JtqEe_YeLaz7aGhW7iWsiI2JBQf.3tMfmiyDHVbXSjl.W1zi9jj17eezqEQNLfU.860LKfWgC m_RWTwRQIumsoZECfqSBxeYoIv0dE3r_YNACE_fVNDddevDdreKnSUAOB2slH25FdEETfgYgce5D f.iQ3fM90ypOpO_kypcUAMAZuZdkO38e8HgAi4o20ggrlDgiMhxiAhFJ8N4XL5qPdyNuXQuB6rTl 4wKquBJ9lGZQ- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic312.consmr.mail.gq1.yahoo.com with HTTP; Sat, 26 Jun 2021 15:30:24 +0000 Received: by kubenode543.mail-prod1.omega.ne1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID a002ee8e47a3d36b91e0744a3a48ac7b; Sat, 26 Jun 2021 15:30:19 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: git: 450f3e55bdad - stable/13 - Work around bogus old gcc "initializer element is not constant" error From: Mark Millard In-Reply-To: <62DD1D7C-68FA-4931-A219-2C90A97A56A7@FreeBSD.org> Date: Sat, 26 Jun 2021 08:30:17 -0700 Cc: dev-commits-src-branches@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <87104032-C5B9-447D-9545-B30AF983ACB7.ref@yahoo.com> <87104032-C5B9-447D-9545-B30AF983ACB7@yahoo.com> <62DD1D7C-68FA-4931-A219-2C90A97A56A7@FreeBSD.org> To: Dimitry Andric X-Mailer: Apple Mail (2.3654.100.0.2.22) X-Rspamd-Queue-Id: 4GByVn2qpwz4ryb X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Jun 2021 15:30:25 -0000 On 2021-Jun-26, at 06:36, Dimitry Andric wrote: > On 26 Jun 2021, at 06:11, Mark Millard wrote: >>=20 >> Dimitry Andric dim at FreeBSD.org wrote on >> Fri Jun 25 18:46:00 UTC 2021 : >>=20 >> . . . >>> In file included from /workspace/src/lib/msun/src/s_llround.c:11:0: >>> /workspace/src/lib/msun/src/s_lround.c:54:31: error: initializer = element is not constant >>> static const type dtype_min =3D type_min - 0.5; >>> ^~~~~~~~ >>> /workspace/src/lib/msun/src/s_lround.c:55:31: error: initializer = element is not constant >>> static const type dtype_max =3D type_max + 0.5; >>> ^~~~~~~~ >>>=20 >>> Since 'type_min' and 'type_max' are constants declared just above = these >>> lines this error is nonsensical, but older gcc's are not smart = enough. >> . . . >>=20 >> Well, in C "const" historically means closer to "read-only" than >> to is-a-constant-expression in the language, unfortunately. Part >> of this is the conversion away from being an lvalue (so: where >> an lvalue is not required) loses the const qualification as part >> of the conversion. >=20 > FWIW, this changed in gcc 8.1+, here: > = https://gcc.gnu.org/git/?p=3Dgcc.git;a=3Dcommit;h=3Df9c59f7e9511856bd6dc13= d2d4904ebd9249c095 >=20 > referencing these bugs: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D66618 > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D69960 >=20 > In one of the comments, joseph@codesourcery.com mentions: >> Although diagnosing this probably makes sense, it's not required by = the >> standard ("An implementation may accept other forms of constant >> expressions." - and this expression doesn't contain "assignment, >> increment, decrement, function-call, or comma operators", so isn't >> required by the Constraints for constant expressions not to be one). >=20 > I guess the gcc people also decided that POLA applied here. :) Yea. If one wants one's C code to reliably compile in valid C compilers generally, one must avoid treating such things as type_min in: static const type type_min =3D (type)DTYPE_MIN; as any of an integer, floating, enumeration, or character constant (in C terms). (C++ used the likes of "integer literal" as terminology to avoid the ambiguity that makes "integer constant" read funny vs. what is a constant expression.) Otherwise some compilers may reject the code without violating the language standard. =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)