https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83456
--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
And another test case from bug 84095 comment #9, also due to the check in
gimple-fold.c. This one seems closer to the first test case in comment #0.
$ cat t.c && gcc -O2 -S -Wall t.c
extern void* memcpy (void*, const void*, __SIZE_TYPE__);
struct netdevice {
void *priv;
};
struct ip_tunnel {
struct netdevice *dev;
int ip6rd[3];
};
struct sit_net {
struct netdevice *fb_tunnel_dev;
};
void ipip6_tunnel_clone_6rd (struct netdevice *dev, struct sit_net *sitn)
{
struct ip_tunnel *t = dev->priv;
if (t->dev == sitn->fb_tunnel_dev)
return;
struct ip_tunnel *t0 = sitn->fb_tunnel_dev->priv;
memcpy(&t->ip6rd, &t0->ip6rd, sizeof(t->ip6rd));
}
void sit_init_net (struct sit_net *sitn, struct netdevice *fb_tunnel_dev)
{
sitn->fb_tunnel_dev = fb_tunnel_dev;
ipip6_tunnel_clone_6rd (sitn->fb_tunnel_dev, sitn);
}
t.c: In function ‘sit_init_net’:
t.c:23:3: warning: ‘memcpy’ source argument is the same as destination
[-Wrestrict]
memcpy(&t->ip6rd, &t0->ip6rd, sizeof(t->ip6rd));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~