something to warry about...

Denys Vlasenko vda.linux at googlemail.com
Sat Jan 15 22:27:55 UTC 2011


On Thursday 13 January 2011 23:20, Cristian Ionescu-Idbohrn wrote:
> ...or just another gcc oddity?

I have no idea how to suppress them all. For example, this one:

networking/ifplugd.c: In function ‘detect_link_priv’:
networking/ifplugd.c:163: warning: dereferencing pointer ‘mii’ does break strict-aliasing rules
networking/ifplugd.c:155: note: initialized from here

Here's the code:

static smallint detect_link_priv(void)
{
        struct ifreq ifreq;
        struct mii_ioctl_data *mii = (void *)&ifreq.ifr_data;  <====== LINE 155

        set_ifreq_to_ifname(&ifreq);

        if (network_ioctl(SIOCDEVPRIVATE, &ifreq, "SIOCDEVPRIVATE") < 0) {
                return IFSTATUS_ERR;
        }

        mii->reg_num = 1; <================= LINE 163

        if (network_ioctl(SIOCDEVPRIVATE+1, &ifreq, "SIOCDEVPRIVATE+1") < 0) {
                return IFSTATUS_ERR;
        }

        return (mii->val_out & 0x0004) ? IFSTATUS_UP : IFSTATUS_DOWN;
}

How to get rid of the warning here?!

-- 
vda


More information about the busybox mailing list