https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84095

--- Comment #9 from Arnd Bergmann <arnd at linaro dot org> ---
I found another false-positive -Wrestrict warning, did a manual reduction. Let
me know if I should better open separate bugs for each test case, or you prefer
to have them all here.

$ aarch64-linux-gcc-8.0.1 -Wall -O2 -c sit.i 
sit.i: In function 'sit_init_net':
sit.i:29:2: warning: 'memcpy' source argument is the same as destination
[-Wrestrict]
  memcpy(&t->ip6rd, &t0->ip6rd, sizeof(t->ip6rd));
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

void *memcpy(void *, const void *, unsigned long );
struct ip_tunnel_6rd_parm {
        int relay_prefix;
        int prefixlen;
        int relay_prefixlen;
};
struct netdevice {
        void *priv;
};
struct ip_tunnel {
        struct netdevice *dev;
        struct ip_tunnel_6rd_parm ip6rd;
};
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));
}
int 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);
        return 0;
}

Reply via email to