From owner-freebsd-mips@FreeBSD.ORG Wed Feb 18 15:28:18 2009 Return-Path: Delivered-To: mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4EBD0106564A; Wed, 18 Feb 2009 15:28:18 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 09D928FC12; Wed, 18 Feb 2009 15:28:17 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n1IFPoLM056703; Wed, 18 Feb 2009 08:25:50 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Wed, 18 Feb 2009 08:25:59 -0700 (MST) Message-Id: <20090218.082559.-1112729020.imp@bsdimp.com> To: andrew-freebsd@areilly.bpc-users.org From: "M. Warner Losh" In-Reply-To: <20090218110402.GA13040@duncan.reilly.home> References: <20090217.203647.-1518647466.imp@bsdimp.com> <20090217.222152.-109416210.imp@bsdimp.com> <20090218110402.GA13040@duncan.reilly.home> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: mips@freebsd.org, tinderbox@freebsd.org, current@freebsd.org Subject: Re: [head tinderbox] failure on mips/mips X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Feb 2009 15:28:19 -0000 In message: <20090218110402.GA13040@duncan.reilly.home> Andrew Reilly writes: : On Tue, Feb 17, 2009 at 10:21:52PM -0700, M. Warner Losh wrote: : > In message: <20090217.203647.-1518647466.imp@bsdimp.com> : > "M. Warner Losh" writes: : > : In message: <20090218023328.227617302F@freebsd-current.sentex.ca> : > : FreeBSD Tinderbox writes: : > : : /src/usr.sbin/bsnmpd/modules/snmp_mibII/../../../../contrib/bsnmp/snmp_mibII/mibII.c:1016: warning: cast increases required alignment of target type : > 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. : : If the memory that rtm can be pointing to can be either a struct : rt_msghdr or a struct if_msghdr, then shouldn't it really be : pointing to a union of those two, and then the alignment will : sort itself out? (As far as I know, that's the only way that : C99 will guarantee that the right thing happens anyway, : otherwise strict aliasing analysis would allow much worse : badness to happen, potentially.) : : Not looked at the code myself. Perhaps there's a reason why : that would be unworkable. There's a second issue. There's a number of different structures that are type punned to rt_msghdr. I'm worried it would be an ABI change to do that as well. In this case, code inspection shows the code to be fine since the dangerous element isn't touched. Warner