With GCC 9 and -O3, I got In file included from ../include/bits/error.h:1, from ../misc/error.h:57, from ../include/error.h:2, from bench-string.h:60, from bench-strstr.c:22: In function ‘error’, inlined from ‘do_one_test’ at bench-strstr.c:149:7, inlined from ‘do_test’ at bench-strstr.c:201:5, inlined from ‘test_main’ at bench-strstr.c:220:2: ../include/bits/../../misc/bits/error.h:42:5: error: ‘%s’ directive argument is null [-Werror=format-overflow=] 42 | __error_alias (__status, __errnum, __format, __va_arg_pack ()); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In function ‘error’, inlined from ‘do_one_test’ at bench-strstr.c:149:7, inlined from ‘do_test’ at bench-strstr.c:201:5, inlined from ‘test_main’ at bench-strstr.c:227:2: ../include/bits/../../misc/bits/error.h:42:5: error: ‘%s’ directive argument is null [-Werror=format-overflow=] 42 | __error_alias (__status, __errnum, __format, __va_arg_pack ()); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors make[1]: *** [../o-iterator.mk:9: /export/build/gnu/tools-build/glibc-march-9/build-x86_64-linux/benchtests/bench-strstr.o] Error 1 There is do_one_test (impl, s1, s2, fail ? NULL : s1 + len1 - len2);
> do_one_test (impl, s1, s2, fail ? NULL : s1 + len1 - len2); >grep "do_one_test.*NULL" -R * benchtests/bench-strstr.c: do_one_test (impl, s1, s2, fail ? NULL : s1 + len1 - len2); benchtests/bench-strstr.c: do_one_test (impl, hs, ne, NULL); benchtests/bench-strstr.c: do_one_test (impl, hs, ne, NULL); benchtests/bench-strstr.c: do_one_test (impl, hs, ne, NULL); benchtests/bench-strcasestr.c: do_one_test (impl, s1, s2, fail ? NULL : s1 + len1 - len2); string/test-strstr.c: do_one_test (impl, s1, s2, fail ? NULL : s1 + len1 - len2); string/test-strcasestr.c: do_one_test (impl, s1, s2, fail ? NULL : s1 + len1 - len2); There are many more tests/benchmarks which pass NULL, eg. any string function which can return NULL.
The master branch has been updated by Stefan Liebler <stli@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f0c5a803bdefd15079d23db4ac5c3b9ba1cc2f10 commit f0c5a803bdefd15079d23db4ac5c3b9ba1cc2f10 Author: Stefan Liebler <stli@linux.ibm.com> Date: Wed Jun 19 12:32:04 2019 +0200 Fix gcc 9 build errors for make xcheck. [BZ #24556] This patch fixes the following gcc 9 warnings for "make xcheck" / "make bench": -string/tst-strcasestr.c: ../include/bits/../../misc/bits/error.h:42:5: error: ‘%s’ directive argument is null [-Werror=format-overflow=] -argp/argp-test.c: argp-test.c:130:20: error: ‘%d’ directive writing between 1 and 11 bytes into a region of size 10 [-Werror=format-overflow=] argp-test.c:130:19: note: directive argument in the range [-2147483648, 122] argp-test.c:130:5: note: ‘sprintf’ output between 2 and 12 bytes into a destination of size 10 -nss/tst-field.c: tst-field.c:52:7: error: ‘%s’ directive argument is null [-Werror=format-overflow=] -benchtests/bench-strstr.c: ../include/bits/../../misc/bits/error.h:42:5: error: ‘%s’ directive argument is null [-Werror=format-overflow=] -benchtests/bench-malloc-simple.c: bench-malloc-simple.c:93:16: error: iteration 3 invokes undefined behavior [-Werror=aggressive-loop-optimizations] ChangeLog: [BZ #24556] * string/test-strcasestr.c (check_result): Add NULL check. * nss/tst-field.c (check_rewrite): Likewise. * benchtests/bench-strstr.c (do_one_test): Likewise. * string/test-strstr.c (check_result): Likewise. * argp/argp-test.c (popt): Increase size of buf to 12. * benchtests/bench-malloc-simple.c (bench): Do not initialize tests array out of bounds.
Fixed with comment 2. If you've still get warnings with gcc9, please reopen this bug.