From owner-svn-src-projects@FreeBSD.ORG Thu Jul 9 16:41:05 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C8AF31065706; Thu, 9 Jul 2009 16:41:05 +0000 (UTC) (envelope-from kientzle@freebsd.org) Received: from kientzle.com (kientzle.com [66.166.149.50]) by mx1.freebsd.org (Postfix) with ESMTP id 9480E8FC29; Thu, 9 Jul 2009 16:41:05 +0000 (UTC) (envelope-from kientzle@freebsd.org) Received: (from root@localhost) by kientzle.com (8.14.3/8.14.3) id n69G20E9016339; Thu, 9 Jul 2009 09:02:00 -0700 (PDT) (envelope-from kientzle@freebsd.org) Received: from dark.x.kientzle.com (fw2.kientzle.com [10.123.1.2]) by kientzle.com with SMTP id wutsgkqes44eeze6s3ekxw36bn; Thu, 09 Jul 2009 09:01:59 -0700 (PDT) (envelope-from kientzle@freebsd.org) Message-ID: <4A561477.7000508@freebsd.org> Date: Thu, 09 Jul 2009 09:01:59 -0700 From: Tim Kientzle User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.8.1.21) Gecko/20090601 SeaMonkey/1.1.16 MIME-Version: 1.0 To: =?UTF-8?B?RGFnLUVybGluZyBTbcO4cmdyYXY=?= References: <200907081526.n68FQYDb055185@svn.freebsd.org> <20090709041145.G46111@delplex.bde.org> <86prc9g8yf.fsf@ds4.des.no> In-Reply-To: <86prc9g8yf.fsf@ds4.des.no> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org, Rui Paulo , Bruce Evans Subject: Re: svn commit: r195460 - projects/mesh11s/sys/net80211 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jul 2009 16:41:06 -0000 Dag-Erling Smørgrav wrote: > Bruce Evans writes: >> Broken ABIs (e.g., arm?) may add padding at the end of structs, > > Padding at the end of a struct is *required* to ensure proper alignment > of the next element in an array, e.g. > > struct foo { int i; char c; } bar[2]; > > Assuming a four-byte alignment requirement for int, the compiler *must* > add three bytes of padding at the end of struct foo so bar[1].i is > correctly aligned. > > cf. ISO/IEC 9899:1999 §6.7.2.1: > > 15 There may be unnamed padding at the end of a structure or union. Everyone (I hope!) expects alignment in the case you outlined. But many of us have been surprised to see the ARM compiler pad struct foo { char f1[4]; char f2[1]; char f3[1]; }; to 12 bytes. This breaks a lot of traditional code that uses structs of char arrays to define memory and disk layouts. I'm not claiming that the ARM compiler is broken, just that its padding behavior surprises a lot of people. Tim