[head tinderbox] failure on mips/mips
M. Warner Losh
imp at bsdimp.com
Tue Feb 17 21:24:49 PST 2009
In message: <20090217.203647.-1518647466.imp at bsdimp.com>
"M. Warner Losh" <imp at bsdimp.com> writes:
: In message: <20090218023328.227617302F at freebsd-current.sentex.ca>
: FreeBSD Tinderbox <tinderbox at freebsd.org> writes:
: : /src/usr.sbin/bsnmpd/modules/snmp_mibII/../../../../contrib/bsnmp/snmp_mibII/mibII.c:1016: warning: cast increases required alignment of target type
:
: there's still 3 or 4 of these in the tree that I'm trying to track
: back to root cause. A simple (void *) fixes the problem, but I want
: to understand the issues before I slap that bad-boy in there...
The first one is:
case RTM_IFINFO:
ifm = (struct if_msghdr *)rtm;
mib_extract_addrs(ifm->ifm_addrs, (u_char *)(ifm + 1), addrs);
if ((ifp = mib_find_if_sys(ifm->ifm_index)) == NULL)
break;
rtm is of type struct rt_msghdr. This has an alignment requirement of
4 on mips, at least on 32-bit mips (the biggest data element is a
u_long). struct if_msghdr has an alignment requirement of 8, because
time_t is int64_t on MIPS, which is 8-bytes in size.
One way to fix this is to add __aligned(8) to struct rt_msghdr to
compensate for this. Otherwise, if the time_t element is referenced
in ifm_data we'll core dump.
But that doesn't seem very portable and seems like a hack.
Adding (void *) to "fix" the warning would be even worse...
Anybody else have any ideas?
Warner
More information about the freebsd-current
mailing list