https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109959

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
+FAIL: c-c++-common/Wrestrict.c  -Wc++-compat  (test for excess errors)
Excess errors:
/home/apinski/src/upstream-gcc-git/gcc/gcc/testsuite/c-c++-common/Wrestrict.c:684:3:
warning: 'strcpy' accessing 2 bytes at offsets [0, 1] and 0 overlaps between 1
and 2 bytes at offset [0, 1] [-Wrestrict]
  T (8, "0", a + r, a);   /* { dg-warning "accessing between 1 and 2 bytes at
offsets \\\[0, 1] and 0 overlaps up to 2 bytes at offset \\\[0, 1]" "strcpy" {
xfail *-*-*} } */

Looks like the dg-warning needs to be updated and the xfail removed.
we have:
```
strcpy (a+[0,1], a);
```



/home/apinski/src/upstream-gcc-git/gcc/gcc/testsuite/c-c++-common/Wrestrict.c:863:3:
warning: 'strncpy' accessing 1 byte at offsets 0 and [0, 1] may overlap 1 byte
at offset 0 [-Wrestrict]

  T ("0123", a, a + i, 1);

In this case a and a+[0,1] can overlap for strncpy even for size of 1.

/home/apinski/src/upstream-gcc-git/gcc/gcc/testsuite/c-c++-common/Wrestrict.c:866:3:
warning: 'strncpy' accessing 2 bytes at offsets 0 and [0, 1] overlaps between 1
and 2 bytes at offset [0, 1] [-Wrestrict]
  T ("0123", a, a + i, 2);   /* { dg-warning "accessing 2 bytes at offsets 0
and \\\[0, 1] may overlap 1 byte at offset 1" "strncpy" { xfail *-*-* } } */

Just like the first case.

Reply via email to