From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NXdE7-0006YJ-Tq for qemu-devel@nongnu.org; Wed, 20 Jan 2010 11:16:15 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NXdE3-0006WH-05 for qemu-devel@nongnu.org; Wed, 20 Jan 2010 11:16:15 -0500 Received: from [199.232.76.173] (port=38913 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NXdE2-0006W9-Nk for qemu-devel@nongnu.org; Wed, 20 Jan 2010 11:16:10 -0500 Received: from mail2.shareable.org ([80.68.89.115]:55412) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NXdE2-0004PN-Aq for qemu-devel@nongnu.org; Wed, 20 Jan 2010 11:16:10 -0500 Date: Wed, 20 Jan 2010 16:16:07 +0000 From: Jamie Lokier Subject: Re: [Qemu-devel] Re: [PATCH 07/17] block/vvfat.c: fix warnings with _FORTIFY_SOURCE Message-ID: <20100120161607.GA7348@shareable.org> References: <85e877202ec86dac15d392f5e88d5b5d76e3b02f.1263944807.git.quintela@redhat.com> <20100120103324.GA17856@redhat.com> <4B56ECBC.40804@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Kirill A. Shutemov" Cc: Kevin Wolf , Juan Quintela , Markus Armbruster , qemu-devel@nongnu.org Kirill A. Shutemov wrote: > On Wed, Jan 20, 2010 at 3:03 PM, Markus Armbruster wrote: > > "Kirill A. Shutemov" writes: > >> No, compiler can't add anything between. 'char' is always byte-aligned. > > > > You got some reading to do then. > > Do you want to say that it's not true? Could you provide an example > when 'char' isn't byte-aligned? I have no example, but that doesn't mean there is no architecture, ABI or host OS where it happens. Architectures can be surprising. It's very easy to make assumptions which break on some architecture you've never tested on. Take this code: struct part1 { char c[5]; }; struct part2 { char c[3]; }; struct all { struct part1 p1; struct part2 p2; }; What do you think the size is on ARM? Hint: not 8 when using GCC < 4, but it is 8 when using current GCC and the later ARM ABI. This broke some data parsing application when it was ported from x86 to ARM, because of a wrong assumption about structure layout that works on nearly all architectures and passed all testing prior to the port. -- Jamie