This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: Re: help!
- From: tony_hcb <tony_hcb at sina dot com>
- To: 'Eric Botcazou' <ebotcazou at libertysurf dot fr>
- Cc: ebotcazou at multimania dot com, gcc at gnu dot org, gcc-owner at gcc dot gnu dot org
- Date: Mon, 01 Jul 2002 21:27:56 +0800
- Subject: RE: Re: help!
Can you explain in detail the meaning of 16-byte alignment?
As with "char *a[b]", we change b with 1,2,3, to 17 and got the table as below:
------------------------------------------------------------------1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ....
4 8 24 24 40 40 40 40 56 56 56 56 72 72 72 72 80 ....
------------------------------------------------------------------
According to your explain,we can see, from 5 to bigger number, the 16-byte alignment is active. But we still don't understand the allocation from 1
to 4.
Hope for your email.
Many thanks.
----- Original Message -----
From:"Eric Botcazou" <ebotcazou@libertysurf.fr>
To:"tony_hcb" <tony_hcb@sina.com>
Subject:Re: help!
Date:Fri, 28 Jun 2002 19:02:56 +0800
>> WHY?
>
>In order to enforce 16-byte stack alignment.
>
>> According to our knowledge, the number should be 12 rather than 24.
>
>egcs 1.1.2 gives 4, 8, 12 respectively because it enforced only 4-byte
>alignment.
>
>> CAN YOU EXPLAIN THE REASON AND THE RULES OF STACK SPACE ALLOCATION?
>
>I use gcc 3.1 as the support, which gives 8, 8, 24 respectively:
>- the stack is 16-byte aligned at startup,
>- calling main() pushes 4 bytes onto the stack,
>- likewise for pushl %ebp,
>
>Therefore, to enforce 16-byte alignment after allocating local variables,
>you need to substract 8 from the stack pointer if there are less than 2
>dword variables, otherwise 24 if there are less than 6 dword variables and
>so on.
>
>--
>Eric Botcazou
>ebotcazou@multimania.com
>
>
>
______________________________________
===================================================================
新浪免费电子邮箱 (http://mail.sina.com.cn)
新浪分类信息:二手市场走一走,该出手时就出手! (http://classad.sina.com.cn/2shou/)