[pacman-dev] [PATCH] Fix gcc strict-overflow error

Allan McRae allan at archlinux.org
Tue Sep 20 12:50:29 UTC 2016

On 18/09/16 01:13, Rikard Falkeborn wrote:
> Recent gcc (tested with 6.2.1) produces the following error when
> compiling with both --enable-warningflags and --enable-debug.
> In particular, it seems it is the combination of GCC_STACK_PROTECT_LIB
> and -Wstrict-overflow=5 produces the error.
>     be_local.c:609:4: error: assuming signed overflow does not occur
>                              when simplifying conditional
>                              [-Werror=strict-overflow]
>     if(count > 0) {
> Fix this by changing the type of count from int to size_t, which is
> fine since count is never negative.


I was a bit wary given we are still returning casting to an int in the
return, but this brings the local db handling of counts in line with the
sync_db function so doe snot make anything worse...


More information about the pacman-dev mailing list