Status of -fstack-usage?

Ioannis E. Venetis iev@hpclab.ceid.upatras.gr
Thu Jan 19 17:56:00 GMT 2006


I sent the following to Olivier, but forgot to CC this list.

Ioannis

------------------------------------------------------------

Hello,

>  Well, it depends :)
> 
>  Would __builtin_stack_size (F) retrieve information about F's stack frame
>  only, or would it also recursively account for every other function that
>  F may call ?
> 
>  Implementing the former is probably possible, though I'm not sure
>  exactly how useful it would be. 
> 

I agree that the former is probably not very useful. If a function is
set to run as a thread and it calls other functions, the stack required
for those functions should be accounted for. Probably the second option
is much more useful.

I had a look here:

http://gcc.gnu.org/onlinedocs/gnat_ugn_unw/Static-Stack-Usage-Analysis.html

I think that the best would be __builtin_stack_size(F) to return what is
described as "dynamic" and "bounded" in the above link. Maybe a return
value of -1 could be used to mean that it was not possible to retrieve
this information. A library could then use a default, bigger stack for
that thread.

Except from recursive functions, what are the other cases where the
above size cannot be computed statically?

Ioannis




More information about the Gcc mailing list