Re: Compiler optimisation bug

From: Nick Hibma <nick_at_van-laarhoven.org>
Date: Tue, 2 May 2017 11:34:45 +0200
>> 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

Received on Tue May 02 2017 - 07:34:54 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:11 UTC