Re: question about allocating local variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Purnendu/Gmail <purnendu@xxxxxxxxx> writes:

> 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

This isn't just for your array. Most of it is for saving the register
    stack. 

>         !#PROLOGUE# 1
>         ret
>         restore
> .LLfe1:
>         .size   main,.LLfe1-main
>         .ident  "GCC: (GNU) 3.0"
> ~
[snip]

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux