From owner-dev-commits-src-branches@freebsd.org Sat Jun 26 13:37:09 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 5F9606541CE for ; Sat, 26 Jun 2021 13:37:09 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GBw052J0bz4lk2; Sat, 26 Jun 2021 13:37:09 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:470:7a58:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "R3" (verified OK)) (Authenticated sender: dim) by smtp.freebsd.org (Postfix) with ESMTPSA id 1674F22479; Sat, 26 Jun 2021 13:37:09 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from smtpclient.apple (unknown [IPv6:2001:470:7a58:0:fdde:db3b:9e58:fdb3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id D13F3503FD; Sat, 26 Jun 2021 15:37:06 +0200 (CEST) From: Dimitry Andric Message-Id: <62DD1D7C-68FA-4931-A219-2C90A97A56A7@FreeBSD.org> Content-Type: multipart/signed; boundary="Apple-Mail=_3B5EC8AB-C527-4078-B664-D7E8181F4659"; protocol="application/pgp-signature"; micalg=pgp-sha1 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 Date: Sat, 26 Jun 2021 15:36:54 +0200 In-Reply-To: <87104032-C5B9-447D-9545-B30AF983ACB7@yahoo.com> Cc: dev-commits-src-branches@freebsd.org To: Mark Millard References: <87104032-C5B9-447D-9545-B30AF983ACB7.ref@yahoo.com> <87104032-C5B9-447D-9545-B30AF983ACB7@yahoo.com> X-Mailer: Apple Mail (2.3654.100.0.2.22) 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 13:37:09 -0000 --Apple-Mail=_3B5EC8AB-C527-4078-B664-D7E8181F4659 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 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. FWIW, this changed in gcc 8.1+, here: = https://gcc.gnu.org/git/?p=3Dgcc.git;a=3Dcommit;h=3Df9c59f7e9511856bd6dc13= d2d4904ebd9249c095 referencing these bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D66618 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D69960 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). I guess the gcc people also decided that POLA applied here. :) -Dimitry --Apple-Mail=_3B5EC8AB-C527-4078-B664-D7E8181F4659 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCYNctdgAKCRCwXqMKLiCW oyaBAKCIxLTfSv2mK433xEngt8cL7h8RwACfXQSraD/vRSxylfCnPel9wcMtvPw= =7uA2 -----END PGP SIGNATURE----- --Apple-Mail=_3B5EC8AB-C527-4078-B664-D7E8181F4659--