From owner-freebsd-current@freebsd.org Tue May 2 09:34:54 2017 Return-Path: Delivered-To: freebsd-current@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 31BB3D5A8E0 for ; Tue, 2 May 2017 09:34:54 +0000 (UTC) (envelope-from nick@van-laarhoven.org) Received: from valery.hibma.org (valery.hibma.org [IPv6:2a02:2308::216:3eff:fe79:3a6c]) by mx1.freebsd.org (Postfix) with ESMTP id F3CDB10F3 for ; Tue, 2 May 2017 09:34:53 +0000 (UTC) (envelope-from nick@van-laarhoven.org) Received: from [IPv6:2001:980:530a:1:f971:3b91:5cc3:9c3e] (unknown [IPv6:2001:980:530a:1:f971:3b91:5cc3:9c3e]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by valery.hibma.org (Postfix) with ESMTPSA id DD4D16E0A15; Tue, 2 May 2017 11:34:45 +0200 (CEST) From: Nick Hibma Message-Id: Content-Type: multipart/signed; boundary="Apple-Mail=_45DF1E72-342F-4E90-93F0-95CC15E5CDE1"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: Compiler optimisation bug Date: Tue, 2 May 2017 11:34:45 +0200 In-Reply-To: <20170502083438.GA1622@kib.kiev.ua> Cc: FreeBSD Current Mailing List To: Konstantin Belousov References: <3626A28E-9DF5-4775-BAAB-CC6C36D2CD01@van-laarhoven.org> <20170502083438.GA1622@kib.kiev.ua> X-Mailer: Apple Mail (2.3273) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 09:34:54 -0000 --Apple-Mail=_45DF1E72-342F-4E90-93F0-95CC15E5CDE1 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii >> Should this be reported to the clang folks? Or is this to be expected = when abusing integer overflows this way? >=20 > You will get an answer that this is expected. Add -fwrapv compiler = flag > to make signed arithmetic behave in a way different from the = mine-field, > or remove the code. For kernel, we use -fwrapv. Thanks, that was what I expected. I searched for -fwrapv and found = similar comments. The code has been rewritten to not depend on overflow for its checks, so = it works properly with any sized time_t (assuming that it is an integer = though :). I'll commit it after feedback. Nick --Apple-Mail=_45DF1E72-342F-4E90-93F0-95CC15E5CDE1 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 Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJZCFK1AAoJEB9yHO7GNHbgAsMQAMwyWY9sYIVKv1rjV/MOisj6 4SZEh638XN5cN5d7XpgwlTqyFyVhcKgutIhI5EC2wvMB1cWRdeXkcI2QyZs1rlZU mhnJHPZBtspGYF9lzY9bU5yEnepVUsoqD5/ztDXNxWfzSJLPazVAksYUcBFMsq+d pKJn/xZIGOnB1rFvLScm5Z/+40cCp4c3UDGUuLLS1JFefllCrY4ydq91H1k91bm3 qd6ULuoEwfIb72NdJ2zaXzjrAvWWffnr9ZzC01JoovKmlKMJi3MKHzE1RR+gxv8x QHn8KK2gXbUjbCmfhUEtLUha58uBN/r0NAl/FoPksHM/Voaew3/w4ozL15VvdeAT M2MHoyHw4eBGBqArp/bITZhsJZtfceOYhaj9YywTYuQ13vVm7DPJDasMXU2z6Lu7 H6RW7RogO6jlxoBSy/ywIrjxkiqgRDJ23koT3PGy5H1KlQvEookICF14qs6ZxLjA VXntqfnt1NVAMmYK5vFae2dcdMrW0GGLzM4eV133N+O/gBBABBjAdk0+zcsoNJwp bDqaCXLiqrTPixjGBGn0yQbhnWw9zX2X7sXaD8KoHnoWtas4MbZzN3dVUpLRXL47 UuHyKsHXFbuwwIENFctXAwNnQYFXFJVSxoxeLmriUwYZrGKm4ghf5lq6lTCEFSNb 67HOdmHl8zS3AlioEKMl =2gg6 -----END PGP SIGNATURE----- --Apple-Mail=_45DF1E72-342F-4E90-93F0-95CC15E5CDE1--