[C++ PATCH] Deprecate -ffriend-injection
[official-gcc.git] / gcc / testsuite / gcc.dg / pr29215.c
blobfc1a0af87a91fd798d3fa5d819c56b73b9abeaea
1 /* PR middle-end/29215 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -fdump-tree-ccp1" } */
5 char buf[5 * sizeof (int) + 1] __attribute__((aligned (__alignof__ (int))));
7 static void
8 foo (int arg1, int arg2, int arg3, int arg4, int arg5)
10 __builtin_memcpy (buf, &arg1, sizeof (int));
11 __builtin_memcpy (buf + sizeof (int), &arg2, sizeof (int));
12 __builtin_memcpy (buf + 2 * sizeof (int), &arg3, sizeof (int));
13 __builtin_memcpy (buf + 3 * sizeof (int), &arg4, sizeof (int));
14 __builtin_memcpy (buf + 4 * sizeof (int), &arg5, sizeof (int));
17 int
18 main (void)
20 union { char buf[4]; int i; } u;
21 u.i = 0;
22 u.buf[0] = 'a';
23 u.buf[1] = 'b';
24 u.buf[2] = 'c';
25 u.buf[3] = 'd';
26 foo (u.i, u.i, u.i, u.i, u.i);
27 buf[5 * sizeof (int)] = '\0';
28 __builtin_puts (buf);
29 return 0;
32 /* { dg-final { scan-tree-dump-not "memcpy" "ccp1" } } */