Liam-Deacon / phaseshifts

Calculate elastic electron atom scattering (EEAS) phase shifts in solid materials for LEED modelling

Home Page:https://liam-deacon.github.io/phaseshifts/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.