From owner-freebsd-toolchain@freebsd.org Thu Jun 29 21:46:53 2017 Return-Path: Delivered-To: freebsd-toolchain@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 061E7DA622B; Thu, 29 Jun 2017 21:46:53 +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 "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B273A74E59; Thu, 29 Jun 2017 21:46:52 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:470:7a58::287b:b74d:6dec:6d86] (unknown [IPv6:2001:470:7a58:0:287b:b74d:6dec:6d86]) (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 28C1E3615C; Thu, 29 Jun 2017 23:46:50 +0200 (CEST) From: Dimitry Andric Message-Id: Content-Type: multipart/signed; boundary="Apple-Mail=_8A2FDD54-3A69-4E51-A000-4009D22E1C4F"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: head -r320458 (e.g.) amd64 -> powerpc (32-bit) cross-buildworld fails for time libc++ static_asserts and overflow/underflow of long long (system clang/clang++ 4 based build) Date: Thu, 29 Jun 2017 23:46:25 +0200 In-Reply-To: <22F5CFA1-E6A9-4C41-BD43-967105B44C49@dsl-only.net> Cc: Konstantin Belousov , Justin Hibbits , FreeBSD Toolchain , FreeBSD Current To: Mark Millard References: <5B12D9A6-C9A2-4B0D-B32D-D04D7DB1E3BC@dsl-only.net> <55A1694D-BC40-49AE-BEF7-CEE502126E96@FreeBSD.org> <20170629125407.GM1935@kib.kiev.ua> <22F5CFA1-E6A9-4C41-BD43-967105B44C49@dsl-only.net> X-Mailer: Apple Mail (2.3273) X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jun 2017 21:46:53 -0000 --Apple-Mail=_8A2FDD54-3A69-4E51-A000-4009D22E1C4F Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 29 Jun 2017, at 19:16, Mark Millard wrote: >=20 > On 2017-Jun-29, at 5:54 AM, Konstantin Belousov wrote: >>=20 >> On Thu, Jun 29, 2017 at 12:47:10PM +0200, Dimitry Andric wrote: >>> One nasty problem with this is that it is not possible to figure out = at >>> compile time what the size of time_t is. You always need some sort = of >>> configure-time test, and an external define. >>=20 >> It is arguably possible, with constexpr. >=20 > I took Dimitry's wording as probably referring to > testing the size in the C/C++ preprocessor like > the original code tests for __LP64__ being defined > vs. not to control what it does: extending that to > involve more preprocessor tests to pick from more > code blocks. (But it is a guess given his wording.) Yeah, what I meant is that the code does something like: #if __LP64__ static_assert(whatever, "foo"); #else static_assert(otherthing, "bar"); #endif where __LP64__ was erroneously thought to determine whether time_t was 64-bit. You cannot replace this with something like the following C++11 construct, though: constexpr bool time_t_64bit =3D sizeof(time_t) =3D=3D 8; if (time_t_64bit) static_assert(true, "time_t is OK"); else static_assert(false, "time_t is bad"); because both static assertions will be evaluated at compile time, and one of them will fail. In any case, Eric Fiselier already had some sort of patch lined up, but I slacked off on trying it out. Sorry about that. :) -Dimitry --Apple-Mail=_8A2FDD54-3A69-4E51-A000-4009D22E1C4F 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.0.30 iEYEARECAAYFAllVdUkACgkQsF6jCi4glqN3wACfVKTqwhL8YMitgny3Am39EozG vcIAnR4c7W/vYn89hZEtrWmXhek3Dis/ =CeAt -----END PGP SIGNATURE----- --Apple-Mail=_8A2FDD54-3A69-4E51-A000-4009D22E1C4F--