This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
will gcc support better stack space reuse?
- From: "Marc E. Fiuczynski" <mef at CS dot Princeton dot EDU>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Mon, 11 Jul 2005 23:51:19 -0400
- Subject: will gcc support better stack space reuse?
Hi,
Was wondering whether a new version of GCC for x86 (linux) can now
reallocate unused stack space from locals defined in different scopes.
E.g., functions suck1 and suck2 suffer from increased stack pressure because
gcc (in my case 3.3.3 on linux/x86) cannot smartly reuse the stack space.
Anyone out there with insight on why this is the case and when gcc might
handle stack packing (if not already).
int garray[64];
static inline numberone(int a, int b){
int array[64];
array[1]=a*b;
garray[0]=array[1];
}
static inline numbertwo(int a, int b){
int array[64];
array[1]=a*b;
garray[1]=array[1];
}
void suck1(int a, int b){
numberone(a,b);
numbertwo(a,b);
}
void suck2(int a, int b){
{
int array[64];
array[1]=a*b;
garray[0]=array[1];
}
{
int array[64];
array[1]=a*b;
garray[1]=array[1];
}
}
Marc