From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6943 invoked by alias); 22 Apr 2003 10:34:23 -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 6927 invoked from network); 22 Apr 2003 10:34:23 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 22 Apr 2003 10:34:23 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h3MAYND31748 for ; Tue, 22 Apr 2003 06:34:23 -0400 Received: from redhat.com (IDENT:ne1YJV+SELvZ4NvNVYMoGV+vc3R2WYVJ@vpn50-3.rdu.redhat.com [172.16.50.3]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h3MAYMq21974 for ; Tue, 22 Apr 2003 06:34:22 -0400 Received: (from aph@localhost) by redhat.com (8.11.6/8.11.0) id h3MAYI706672; Tue, 22 Apr 2003 11:34:18 +0100 From: Andrew Haley MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16037.6826.35777.756256@cuddles.redhat.com> Date: Tue, 22 Apr 2003 11:36:00 -0000 To: Jason Merrill Cc: gcc@gcc.gnu.org Subject: Re: On alignment In-Reply-To: References: <200303251122.13693.kevin.hendricks@sympatico.ca> <200303251344.59988.kevin.hendricks@sympatico.ca> X-SW-Source: 2003-04/txt/msg01051.txt.bz2 WHat I still cannot understand is why a struct that contains a double is 4-aligned on x86, but a double is 8-aligned. This means that you cannot infer the alignment of a struct from the alignment of its members. Is this really part of the multi-vendor ABI? Andrew. #include int main (int argc, char **argv) { typedef struct foo { double x; } foo; foo bar; printf ("double align %d size %d\n", __alignof__(double), sizeof(double)); printf ("foo align %d size %d\n", __alignof__(foo), sizeof(foo)); return 0; }