On a solaris platform with gcc 3.0 the one i have out put for such a behaviour is pretty predictive. It allocates a stack of 120 for char a[1] to char a[8] then 128 for char a[9] to char a[16] and so on. for an integer array It allocates a stack of 120 for int a[1] and int a[2] then 128 for int a[3] to int a[4] and so on. with a allignment of 4 bytes =============== .file "help.c" .section ".text" .align 4 .global main .type main,#function .proc 04 main: !#PROLOGUE# 0 save %sp, -128, %sp !#PROLOGUE# 1 ret restore .LLfe1: .size main,.LLfe1-main .ident "GCC: (GNU) 3.0" ~ =============== Hope i am correct.am i? but then why the initial 120 bytes,??? On Mon, 28 Jun 2004 10:50:13 -0500, Eljay Love-Jensen <eljay@xxxxxxxxx> wrote: > > Hi Prawit, > > >Does anybody has any explaination [why the compiler allocates more than > specified]? > > Alignment. > > You didn't specify what platform, GCC version (3.3.4? 3.4.0?), and compile > options you are using. If you are not generated optimized code, the code > may not be optimized. > > It is also possible that one of the GCC Gnurus made a boo-boo. Rare, but > can happen. Especially between optimizations that are in contention, which > may have unintended side-effects on different platforms. (I discovered 3 > such issues, on GCC 2.95 on Solaris. They're all fixed now.) > > HTH, > --Eljay > >