Compiler optimisation bug
Nick Hibma
nick at van-laarhoven.org
Tue May 2 09:34:54 UTC 2017
>> Should this be reported to the clang folks? Or is this to be expected when abusing integer overflows this way?
>
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 873 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.freebsd.org/pipermail/freebsd-current/attachments/20170502/9b5141a3/attachment.sig>
More information about the freebsd-current
mailing list