https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98411
Bug ID: 98411
Summary: [10/11] Pointless: Array larger than
‘-fmax-stack-var-size=’, moved from stack to static
storage for main program variables
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: vladimir.fuka at gmail dot com
Target Milestone: ---
This program
program p
dimension a(100000)
call random_number(a)
print *,a
end
causes
static.f90:2:13:
2 | dimension a(100000)
| 1
Warning: Array ‘a’ at (1) is larger than limit set by ‘-fmax-stack-var-size=’,
moved from stack to static storage. This makes the procedure unsafe when called
recursively, or concurrently from multiple threads. Consider using
‘-frecursive’, or increase the ‘-fmax-stack-var-size=’ limit, or change the
code to use an ALLOCATABLE array. [-Wsurprising]
This warning is pointless because there are no procedures in the code and main
program arrays are SAVE already. There is no point using -frecursive or doing
anything to the stack. It causes active harm by causing confusion
https://stackoverflow.com/questions/65384213/using-very-large-arrays-in-fortran-gfortran/65391732#65391732