https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84095
--- Comment #12 from Martin Sebor <msebor at gcc dot gnu.org> --- (In reply to Arnd Bergmann from comment #8) I have manually reproduced a similar false positive in the small test case below it's not quite the same issue but I have a fix for both. They're both caused by similar oversights as the one in comment #0, except with slightly different root causes. In the translation unit from comment #8 the checker cannot reliably distinguish between offsets into different members of the same struct and offsets into the same member. In the case below the checker doesn't look deep enough through the array of arrays to see that p->a[i] need not be the same as p->a[0]. I expect to be done testing a fix for both tomorrow. If you have other test case/translation units please do add them here. This has been very helpful -- thanks again! $ cat z.c && gcc -O2 -S -Wall z.c struct S { char a[2][4]; }; void f (struct S *p, int i) { __builtin_strcpy (p->a[0], "012"); __builtin_strcpy (p->a[i] + 1, p->a[0]); } z.c: In function ‘f’: z.c:8:3: warning: ‘__builtin_strcpy’ accessing 4 bytes at offsets 1 and 0 overlaps 3 bytes at offset 1 [-Wrestrict] __builtin_strcpy (p->a[i] + 1, p->a[0]); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~