https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81701
Bug ID: 81701
Summary: -fstack-arrays hehavior does not match documentation
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: tkoenig at gcc dot gnu.org
Target Milestone: ---
The docs say
Adding this option will make the Fortran compiler put all local
arrays, even those of unknown size onto stack memory.
This is not what happens at the moment. Look at
module x
contains
subroutine a(n,r)
real, dimension(10000) :: arr
real :: r
call random_number(arr)
r = sum(arr)
end subroutine a
end module x
which, when translated, gets us
a (integer(kind=4) & restrict n, real(kind=4) & restrict r)
{
static real(kind=4) arr[10000];
{
struct array1_real(kind=4) parm.0;
...
We should change the documented or the actual behavior, or both :)