1 /* PR middle-end/38454 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2" } */
4 
5 typedef __SIZE_TYPE__ size_t;
6 
7 extern inline __attribute__((gnu_inline, always_inline, artificial)) void *
memcpy(void * __restrict dest,const void * __restrict src,size_t len)8 memcpy (void *__restrict dest, const void *__restrict src, size_t len)
9 {
10   return __builtin___memcpy_chk (dest, /* { dg-warning "writing" } */
11 				 src, len, __builtin_object_size (dest, 0));
12 }
13 
14 struct S { char buf[10]; } s;
15 
16 void
foo(void)17 foo (void)
18 {
19   char buf[12];
20   char *p = buf + 4;
21   struct S *q = (struct S *) p;
22   memcpy (q, &s, sizeof (s));
23 }
24 
25 /* { dg-final { scan-assembler "__memcpy_chk" } } */
26