https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107038
--- Comment #8 from Siddhesh Poyarekar <siddhesh at gcc dot gnu.org> ---
I forgot to mention that I've been building with:
gcc/cc1 -o /dev/null ../bogus-stringop-overflow.i -O2 -Werror=stringop-overflow
-quiet
to reproduce the warning:
../bogus-stringop-overflow.i: In function ‘elf_begin_rand’:
../bogus-stringop-overflow.i:35:19: error: ‘foo_alias’ writing 14 or more bytes
into a region of size 10 overflows the destination [-Werror=stringop-overflow=]
35 | ret = foo_alias (buf, nbytes, offset);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../bogus-stringop-overflow.i:14:8: note: destination object ‘ar_size’ of size
10
14 | char ar_size[10];
| ^~~~~~~
../bogus-stringop-overflow.i:8:16: note: in a call to function ‘foo_alias’
declared with attribute ‘access (write_only, 1, 2)’
8 | extern ssize_t foo_alias (void *buf, size_t nbytes, off_t offset)
| ^~~~~~~~~
cc1: some warnings being treated as errors