[PATCH] Enforce strict overflow checking

Andrew Bartlett abartlet at samba.org
Wed Mar 21 17:55:57 UTC 2018


On Wed, 2018-03-21 at 10:26 -0700, Jeremy Allison via samba-technical
wrote:

> Spoke too soon. On my workstation the build passes,
> 
> gcc -v
> gcc version 7.3.0 (Debian 7.3.0-5)
> 
> but on sn-devel we have:
> 
> [ 658/4270] Compiling lib/util/util_file.c
> ../lib/util/util_file.c: In function ???fgets_slash???:
> ../lib/util/util_file.c:108:8: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow]
>   while (len < maxlen-1) {
>         ^
> ../lib/util/util_file.c:108:8: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow]
> cc1: all warnings being treated as errors
> 
> sn-devel-144:~$ gcc -v
> gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.4)
> 
> Andreas, I think you're going to have to work this
> through on sn-devel first if it's going to go
> through.

Or push to github and have travis-ci chew it over (make a pull request
or set it up on the source repo).  Andreas did that (made a pull
request) for the last big set he was working with me and it was great
to have the confidence that the compiler said it was OK.  

(Both Travis CI and sn-devel are ubuntu 14.04, so we get the same
compiler behaviour). 

Andrew Bartlett
-- 
Andrew Bartlett                       http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba




More information about the samba-technical mailing list