Here - only using union. You know, casting pointers doesn't mean that they point to the same area. And doing something like my_super_data_type* ptr = (void*)blah is obviously a way to void.
On Sat, Jan 15, 2011 at 11:27 PM, Denys Vlasenko <[email protected]> wrote: > 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 > _______________________________________________ > busybox mailing list > [email protected] > http://lists.busybox.net/mailman/listinfo/busybox _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
