On 5 February 2015 at 02:48, Luigi Rizzo <ri...@iet.unipi.it> wrote:
> Rather than depending on a compiler option, wouldn't it be better/more
> robust to change ticks to unsigned, which has specified wrapping behavior?

I believe there are cases other than ticks that rely on 2s complement
signed wrap. We'd want to make sure we find such cases.  Newer GCC can
help with that.  The -Wstrict-overflow flag causes the compiler to
warn when implementing an optimization based on undefined behaviour
from signed overflow.

Correct C code should work with or without -fwrapv, so we can do both:
enable -fwrapv, and make changes to stop relying on undefined
behaviour.  For ticks specifically we have many examples over time of
incorrect calculations so we'll benefit from some work here,
independent of signed overflow.
freebsd-current@freebsd.org mailing list
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Reply via email to