https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91707
--- Comment #12 from Martin Sebor <msebor at gcc dot gnu.org> ---
Here's a slightly simplified test case for GCC 12:
$ cat z.c && gcc -O2 -S -Wall -fsanitize=undefined z.c
extern void f (unsigned n, long[n], const long[n]);
void g (unsigned n, const long a[n])
{
long b[n + 1];
f (n, b + 1, a);
long c[n + 1];
(void)c;
}
z.c: In function ‘g’:
z.c:6:4: warning: ‘f’ accessing 34359738360 bytes in a region of size 0
[-Wstringop-overflow=]
6 | f (n, b + 1, a);
| ^~~~~~~~~~~~~~~
z.c:6:4: note: referencing argument 2 of type ‘long int[]’
z.c:6:4: note: referencing argument 3 of type ‘const long int[]’
z.c:1:13: note: in a call to function ‘f’
1 | extern void f (unsigned n, long[n], const long[n]);
| ^