Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 May 2017 11:34:45 +0200
From:      Nick Hibma <nick@van-laarhoven.org>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        FreeBSD Current Mailing List <freebsd-current@FreeBSD.ORG>
Subject:   Re: Compiler optimisation bug
Message-ID:  <AACCB2FA-1B18-4DA3-BC43-FFB1DB4115E6@van-laarhoven.org>
In-Reply-To: <20170502083438.GA1622@kib.kiev.ua>
References:  <3626A28E-9DF5-4775-BAAB-CC6C36D2CD01@van-laarhoven.org> <20170502083438.GA1622@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help

--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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AACCB2FA-1B18-4DA3-BC43-FFB1DB4115E6>