libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / Wrestrict-18.c
blobdbad9566bd3e42587c18ac763c397392aa59bee6
1 /* PR tree-optimization/86196 - Bogus -Wrestrict on memcpy between array
2 elements at unequal indices
3 { dg-do compile }
4 { dg-options "-O2 -Wall" } */
6 typedef __SIZE_TYPE__ size_t;
8 extern void* memcpy (void*, const void*, size_t);
10 struct S
12 int n;
13 void * p;
16 /* Test case submitted in the PR. */
18 void pr86196_c0 (struct S * a, size_t n)
20 for (size_t i = 0, j = 0; i != n; ++i)
22 if (a[i].n == 0)
24 if (i != j)
25 memcpy (&a[j], &a[i], sizeof (struct S)); /* { dg-bogus "\\\[-Wrestrict" } */
26 ++j;
31 /* Reduced test case. */
33 void pr86196_c1 (struct S *a, int i, int j)
35 if (i != j)
36 memcpy (&a[j], &a[i], sizeof (struct S)); /* { dg-bogus "\\\[-Wrestrict" } */