Compiler warns that wrapped `libphsh` functions are not thread safe due to large arrays not fitting into stack memory
Liam-Deacon opened this issue · comments
gfortran
emits worrying warnings such as the following which may prevent the code from being used concurrently and inhibit its use in downstream python packages:
phaseshifts/lib/libphsh.f:287:40:
287 | dimension orb(nrmax,iorbs),rpower(nrmax,0:15)
| 1
Warning: Array ‘rpower’ 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 increasing
the ‘-fmax-stack-var-size=’ limit (or use ‘-frecursive’, which implies unlimited ‘-fmax-stack-var-size’) - or change the
code to use an ALLOCATABLE array. If the variable is never accessed concurrently, this warning can be ignored, and
the variable could also be declared with the SAVE attribute. [-Wsurprising]
NOTE: tested with
gfortran
versions 11 and 12
This is an issue with the Fortran77 compilation mode, with suggestions online to move to FORTRAN90 source with ALLOCATABLE
arrays.