Thanks for the code example. The program compiles and runs, giving the same result with gfortran and ifort, even if func
is declared pure
. A pure
function can access a variable such as a
but cannot change it. I believe func
cannot be declared simple (a feature of Fortran 202x) because it accesses a
.