Date: Thu, 5 Feb 2015 08:59:30 -0500 From: Ed Maste <emaste@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: <CAPyFy2A3qSYReMAETbTeiQr%2B3Jh2HVc%2BpSmcuwbmcZybFku=VA@mail.gmail.com> 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 February 2015 at 02:48, Luigi Rizzo <rizzo@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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAPyFy2A3qSYReMAETbTeiQr%2B3Jh2HVc%2BpSmcuwbmcZybFku=VA>