Re: PSA: If you run -current, beware!

From: Ed Maste <emaste_at_freebsd.org>
Date: Thu, 5 Feb 2015 08:59:30 -0500
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.
Received on Thu Feb 05 2015 - 12:59:52 UTC

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