From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11676 invoked by alias); 22 Apr 2003 18:24:03 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 11594 invoked from network); 22 Apr 2003 18:24:02 -0000 Received: from unknown (HELO lacrosse.corp.redhat.com) (66.187.233.200) by sources.redhat.com with SMTP; 22 Apr 2003 18:24:02 -0000 Received: from prospero.boston.redhat.com (sebastian-int.corp.redhat.com [172.16.52.221]) by lacrosse.corp.redhat.com (8.11.6/8.9.3) with ESMTP id h3MINuV20759; Tue, 22 Apr 2003 14:23:56 -0400 Received: by prospero.boston.redhat.com (Postfix, from userid 4046) id 6FFF7F8D67; Tue, 22 Apr 2003 14:21:21 -0400 (EDT) To: Nicola Pero Cc: Andrew Haley , Robert Dewar , , , Subject: Re: On alignment From: Jason Merrill In-Reply-To: (Nicola Pero's message of "Tue, 22 Apr 2003 17:04:38 +0100 (BST)") References: Date: Tue, 22 Apr 2003 18:46:00 -0000 Message-ID: User-Agent: Gnus/5.090013 (Oort Gnus v0.13) Emacs/21.2 (i386-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-04/txt/msg01082.txt.bz2 On Tue, 22 Apr 2003 17:04:38 +0100 (BST), Nicola Pero wrote: > At runtime, the ObjC runtime library has information about the struct - > the type of each member. At the moment, it loops on the struct members, > and uses __alignof__ on each of them to get the alignment of that member > inside the struct (then, can read/write the struct members). As far as I > understand from this discussion, this doesn't work any longer. If you actually take __alignof the member, this should work fine. If you do __alignof the type, you will get the larger number. On Tue, 22 Apr 2003 17:19:28 +0100, Andrew Haley wrote: > It's rather scary. It means, for example, that > > template void copy (T *a, T *b) > { > if (__alignof__ (T) >= 8) > copy_by_dwords (a, b); > else > copy_by_bytes (a, b); > } > > won't do what is expected when applied to a member of a struct. I > suppose we get away with this because the x86 never generates > alignment traps in such cases. Exactly. A STRICT_ALIGNMENT target wouldn't do this sort of thing. Jason