Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Feb 2015 09:29:01 +0000
From:      David Chisnall <theraven@FreeBSD.org>
To:        Luigi Rizzo <rizzo@iet.unipi.it>
Cc:        Konstantin Belousov <kostikbel@gmail.com>, "freebsd-current@freebsd.org" <freebsd-current@freebsd.org>, Peter Wemm <peter@wemm.org>
Subject:   Re: PSA: If you run -current, beware!
Message-ID:  <FE51D754-7B35-48A5-8B8D-CA957194D48C@FreeBSD.org>
In-Reply-To: <CA%2BhQ2%2BiVE53PJs0noc_SPHpwDZVLX-tHpgYmzO9tGzJzDXwXWg@mail.gmail.com>
References:  <8089702.oYScRm8BTN@overcee.wemm.org> <20150204142941.GE42409@kib.kiev.ua> <2509923.ondFvsFdql@overcee.wemm.org> <CA%2BhQ2%2BiVE53PJs0noc_SPHpwDZVLX-tHpgYmzO9tGzJzDXwXWg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 5 Feb 2015, at 07:48, Luigi Rizzo <rizzo@iet.unipi.it> wrote:
>=20
> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?FE51D754-7B35-48A5-8B8D-CA957194D48C>