public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* will gcc support better stack space reuse?
@ 2005-07-12  3:51 Marc E. Fiuczynski
  0 siblings, 0 replies; only message in thread
From: Marc E. Fiuczynski @ 2005-07-12  3:51 UTC (permalink / raw)
  To: gcc-help

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-07-12  3:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-12  3:51 will gcc support better stack space reuse? Marc E. Fiuczynski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).