PR middle-end/85602 - -Wsizeof-pointer-memaccess for strncat with size of source
[official-gcc.git] / gcc / testsuite / gcc.dg / memcpy-2.c
blob7f839d27abde09668a9e7620c36bc8e951957e52
1 /* PR middle-end/38454 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2" } */
5 typedef __SIZE_TYPE__ size_t;
7 extern inline __attribute__((gnu_inline, always_inline, artificial)) void *
8 memcpy (void *__restrict dest, const void *__restrict src, size_t len)
10 return __builtin___memcpy_chk (dest, /* { dg-warning "writing" } */
11 src, len, __builtin_object_size (dest, 0));
14 struct S { char buf[10]; } s;
16 void
17 foo (void)
19 char buf[12];
20 char *p = buf + 4;
21 struct S *q = (struct S *) p;
22 memcpy (q, &s, sizeof (s));
25 /* { dg-final { scan-assembler "__memcpy_chk" } } */