PSA: If you run -current, beware!

Ed Maste emaste at freebsd.org
Thu Feb 5 13:59:52 UTC 2015


On 5 February 2015 at 02:48, Luigi Rizzo <rizzo at 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.


More information about the freebsd-current mailing list