Daily bump.
[official-gcc.git] / gcc / testsuite / gcc.dg / Wrestrict-12.c
blob84ab6b50d8b39e1808ee7861d9a8a619339c33fe
1 /* PR tree-optimization/83456 - -Wrestrict false positive on
2 a non-overlapping memcpy in an inline function
3 { dg-do compile }
4 { dg-options "-O2 -Wrestrict -ftrack-macro-expansion=0" } */
6 extern void* memcpy (void*, const void*, __SIZE_TYPE__);
8 /* Test case from comment #0. */
10 inline void pr83456_comment0 (void *d, void *s, unsigned N)
12 if (s != d)
13 memcpy (d, s, N);
16 void call_pr83456_comment0 (void* src)
18 pr83456_comment0 (src, src, 1);
22 /* Test case from comment #1. */
24 char a[4];
26 void pr83456_comment1 (unsigned n)
28 for (int i = 0; i < 1; i++)
30 if (!i)
31 continue;
33 memcpy (a, a, n);
37 /* Test case from comment #2. */
39 struct netdevice {
40 void *priv;
43 struct ip_tunnel {
44 struct netdevice *dev;
45 int ip6rd[3];
48 struct sit_net {
49 struct netdevice *fb_tunnel_dev;
52 void ipip6_tunnel_clone_6rd (struct netdevice *dev, struct sit_net *sitn)
54 struct ip_tunnel *t = dev->priv;
55 if (t->dev == sitn->fb_tunnel_dev)
56 return;
58 struct ip_tunnel *t0 = sitn->fb_tunnel_dev->priv;
59 memcpy(&t->ip6rd, &t0->ip6rd, sizeof(t->ip6rd));
62 void sit_init_net (struct sit_net *sitn, struct netdevice *fb_tunnel_dev)
64 sitn->fb_tunnel_dev = fb_tunnel_dev;
65 ipip6_tunnel_clone_6rd (sitn->fb_tunnel_dev, sitn);