SAVE属性の解説
http://www7b.biglobe.ne.jp/~fortran/education/fortran90/sec8.html
http://jjoo.sakura.ne.jp/tips/f90/initial_save.html
サンプル
2019-01-29_13-22
/work2/am/TOOLS/CODING_SAMPLE/FORTRAN_SAVE
am@localhost
$ cat fortran_save.f90
program fortran_savea=100call sub(a,b)call sub_save(a,b)a=0call sub_save(a,b)end program fortran_savesubroutine sub(a)real,intent(in)::aprint *,'IN SUB: a=',aend subroutine subsubroutine sub_save(a)real,intent(in)::areal,save::bprint *,'IN SUB_SAVE: a=',aif(a==100)thenb=aend ifprint *,'IN SUB_SAVE: b=',bend subroutine sub_save2019-01-29_13-22
/work2/am/TOOLS/CODING_SAMPLE/FORTRAN_SAVE
am@localhost
$ ifort -o fortran_save.exe fortran_save.f90
2019-01-29_13-22
/work2/am/TOOLS/CODING_SAMPLE/FORTRAN_SAVE
am@localhost
$ fortran_save.exe
IN SUB: a= 100.0000
IN SUB_SAVE: a= 100.0000
IN SUB_SAVE: b= 100.0000
IN SUB_SAVE: a= 0.0000000E+00
IN SUB_SAVE: b= 100.0000