PR middle-end/85602 - -Wsizeof-pointer-memaccess for strncat with size of source
[official-gcc.git] / gcc / testsuite / gcc.dg / pr64715-1.c
blobf2c1bd0f97c307c8c112f9c481f2f22845b92b1d
1 /* PR tree-optimization/64715 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -fdump-tree-optimized" } */
5 extern inline __attribute__ ((always_inline, gnu_inline, artificial, nothrow, leaf)) char *
6 strcpy (char *__restrict dest, const char *__restrict src)
8 return __builtin___strcpy_chk (dest, src, __builtin_object_size (dest, 2 > 1));
11 const char *str1 = "JIHGFEDCBA";
12 void bar (char *);
14 void
15 foo ()
17 struct A { char buf1[9]; char buf2[1]; } a;
18 strcpy (a.buf1 + (0 + 4), str1 + 5);
19 bar ((char *) &a);
22 /* { dg-final { scan-tree-dump "__builtin___strcpy_chk\[^;\n\r\]*, 5\\\);" "optimized" } } */