From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28750 invoked by alias); 18 Mar 2003 20:01:48 -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 28510 invoked from network); 18 Mar 2003 20:01:45 -0000 Received: from unknown (HELO cuddles.cambridge.redhat.com) (81.96.64.123) by sources.redhat.com with SMTP; 18 Mar 2003 20:01:45 -0000 Received: (from aph@localhost) by cuddles.cambridge.redhat.com (8.11.6/8.11.0) id h2IK1bG18986; Tue, 18 Mar 2003 20:01:37 GMT From: Andrew Haley MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15991.31521.926999.664353@cuddles.cambridge.redhat.com> Date: Tue, 18 Mar 2003 20:28:00 -0000 To: "Piotr Wyderski" Cc: Subject: Re: __attribute__ ((aligned)) weirdness In-Reply-To: <001201c2ed88$899e8e00$5dec63d9@voltan> References: <15991.15030.380667.367246@cuddles.cambridge.redhat.com> <001201c2ed88$899e8e00$5dec63d9@voltan> X-SW-Source: 2003-03/txt/msg01215.txt.bz2 Piotr Wyderski writes: > > So you have a field at offset 4. You ask for it to be 4-aligned, and > > it jumps to offset 8. > > > > What is going on? > > The alignment of x means that the offset of a variable is divisible > by x with no remainder. Each y=x*2^n (where n is natural) is > a good alignment too, because f mod y = 0 => f mod x = 0; > 8-aligned field is also 4-aligned. So where's the problem? I need to know why this happens. Andrew.