Re: Compiler optimisation bug

2017-05-02 Thread Nick Hibma
>> Should this be reported to the clang folks? Or is this to be expected when >> abusing integer overflows this way? > > You will get an answer that this is expected. Add -fwrapv compiler flag > to make signed arithmetic behave in a way different from the mine-field, > or remove the code. For

Re: Compiler optimisation bug

2017-05-02 Thread Konstantin Belousov
On Tue, May 02, 2017 at 10:26:17AM +0200, Nick Hibma wrote: > There is a bug in sbin/dhclient.c for large expiry values on 32 bit platforms > where time_t is a uint32_t (bug #218980, > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=218980). It is caused by a > compiler optimisation that

Compiler optimisation bug

2017-05-02 Thread Nick Hibma
There is a bug in sbin/dhclient.c for large expiry values on 32 bit platforms where time_t is a uint32_t (bug #218980, https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=218980). It is caused by a compiler optimisation that removes an if-statement. The code below shows the following output,