middle-end/10415: allocated stack space non optimimal

Wolfgang Bangerth bangerth@ices.utexas.edu
Tue Apr 15 20:15:00 GMT 2003


> Program test.c:
> 
> void f() {
> 	char buf[3];
> }
> 
> main() {
> 	f();
> }
> 
> I compile this:
> gcc -S -o test test.c

What happens if you switch on optimization? Is stack allocation better 
then?

[I think that the compiler will just optimize away everything in that 
case, but you might prevent this by doing something like

void p(char *x);
void f() {
  char buf[3];
  p(buf);
}

and simply not defining f().]

W.

-------------------------------------------------------------------------
Wolfgang Bangerth              email:            bangerth@ices.utexas.edu
                               www: http://www.ices.utexas.edu/~bangerth/




More information about the Gcc-bugs mailing list