PSA: If you run -current, beware!

David Chisnall theraven at FreeBSD.org
Thu Feb 5 09:29:31 UTC 2015


On 5 Feb 2015, at 07: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?

Especially if we want to extend support for external toolchains.  gcc and clang support -fwrapv (though occasionally versions of both will not fully support it), but other compilers may well not have an equivalent.

Translating the code into C is a far more robust solution than the band-aid of telling the compiler to accept a language that is a bit like C and hoping that this will keep working across compiler implementations and versions.

Adding -fwrapv also defeats a number of compiler optimisations, so we are going to generate worse code for places where people used signed types correctly to work around places where they were used incorrectly.

David



More information about the freebsd-current mailing list