Hi, when using the warnings module, after commit 5e22aee79f9d02ac37f40f1d18f5696114c3c3c9 also -Walloc-size-larger-than=9223372036854775807 is added to the CFLAGS, if supported (which seems the case with newer GCC versions). However, the value is too big for 32bit architectures, so this will "break" the GCC checks. Let's see the following example on a i686 version of Fedora 26:
$ cat test.c #include <stdlib.h> int main(void) { char *foo = malloc(5); free(foo); return 0; } $ gcc -Walloc-size-larger-than=9223372036854775807 -o test test.c test.c: In function ‘main’: test.c:4:9: warning: argument 1 value ‘5’ exceeds maximum object size -1 [-Walloc-size-larger-than=] char *foo = malloc(5); ^~~ In file included from test.c:1:0: /usr/include/stdlib.h:443:14: note: in a call to allocation function ‘malloc’ declared here extern void *malloc (size_t __size) __THROW __attribute_malloc__ __wur; ^~~~~~ $ gcc --version gcc (GCC) 7.1.1 20170622 (Red Hat 7.1.1-3) $ uname -a Linux fedora 4.11.11-300.fc26.i686+PAE #1 SMP Mon Jul 17 16:53:51 UTC 2017 i686 i686 i386 GNU/Linux Using the PTRDIFF_MAX value on such architecture, i.e. 2147483647, indeed makes the issue go away, and the GCC checks work again (that is, not showing all the allocations as false positives). Does anyone have an idea (or even a patch) to make gnulib pass the right value to GCC? Thanks, -- Pino Toscano
signature.asc
Description: This is a digitally signed message part.