------- Comment #3 from burnus at gcc dot gnu dot org 2009-02-25 10:21 ------- > Is there a reason the Fortran frontend gives function local variables static > storage duration?
For huge arrays, there is a problem if the memory is allocated on the stack, as one quickly hits stack-size limits. Thus gfortran puts large local arrays in static memory, except when a procedure can be called recursively/simultaneously (RECURSIVE attribute, -frecursive, -fopenmp). The size for which this happens is controlled by -fmax-stack-var-size=<n>. Actually, I don't quite see why the "static" matters: As local variable it cannot be accessed from elsewhere and if it is not accessed in the procedure ... Additionally, C's main() and Fortran's PRORGRAM (= "MAIN__") are special because they are only called once. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39298