https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90663
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |NEW Assignee|pinskia at gcc dot gnu.org |unassigned at gcc dot gnu.org --- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #10) > Created attachment 55097 [details] > Patch which I am testing Hmm, one failure +FAIL: c-c++-common/Wrestrict.c -Wc++-compat memcpy (test for warnings, line 120) GCC's code says: /* Avoid diagnosing exact overlap in calls to __builtin_memcpy. It's safe and may even be emitted by GCC itself (see bug 32667). */ Reduced testcase for the missing warning: ``` /* PR 35503 - Warn about restricted pointers { dg-do compile } { dg-options "-O2 -Wrestrict -ftrack-macro-expansion=0" } */ void sink (void*, ...); /* Exercise memcpy with constant or known arguments. */ void test_memcpy_cst (void *d, const void *s) { struct { char a[7]; char b[7]; char c[7]; } x; sink (&x); d = x.a + 7; s = x.b; __builtin_memcpy (d, s, 3); /* { dg-warning "\\\[-Wrestrict" "memcpy" } */ sink (&x); } ``` I am no longer working on this because I am not 100% sure if we want to still warn here or not ...