From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11577 invoked by alias); 26 Jul 2005 03:22:31 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 11547 invoked by uid 22791); 26 Jul 2005 03:22:28 -0000 Received: from yosemite.airs.com (HELO yosemite.airs.com) (205.217.158.180) by sourceware.org (qpsmtpd/0.30-dev) with SMTP; Tue, 26 Jul 2005 03:22:28 +0000 Received: (qmail 30853 invoked by uid 10); 26 Jul 2005 03:20:16 -0000 Received: (qmail 2498 invoked by uid 500); 26 Jul 2005 03:20:09 -0000 Mail-Followup-To: gcc-help@gcc.gnu.org, sabre@nondot.org To: Chris Lattner Cc: gcc-help@gcc.gnu.org Subject: Re: attribute aligned(4) ignored References: From: Ian Lance Taylor Date: Tue, 26 Jul 2005 03:22:00 -0000 In-Reply-To: Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2005-07/txt/msg00273.txt.bz2 Chris Lattner writes: > Hi All, I'm trying to reduce the alignment of the double in this > structure to 4 bytes (from 8) on Darwin. The goal of doing this is to > reduce the structure to 12 bytes in size. Here is my testcase: > > struct Test { > double D __attribute__((aligned(4))); // only 4 bytes, not 8! > int X; > }; > > int X() { > return sizeof(struct Test); // Should return 12, not 16. > } > > Despite my attempt above, the structure is still 16 bytes in size, due > to the tail padding required to pad the structure to ensure 8-byte > alignment. > > Does anyone know how to reduce the alignment of the double, > eliminating the tail padding? How about double D __attribute__((aligned(4), packed)); Ian