7.8.2010
Paul,
First of all, please delete the previous post on this subject. Although this seems to be a very minor “problem”, I have seen it many times. I have now managed to condense the problem to a small (dummy) program named Test: When I compile the program Test with the options /List and /Dump (see compall.txt), I find in the list Test.lis 7 Save attributes for local variables.
SAVE INTEGER(KIND=3) IFALLL(10)
SAVE INTEGER(KIND=3) M
SAVE INTEGER(KIND=3) MAX_I
SAVE INTEGER(KIND=3) MIN_I
SAVE REAL(KIND=1) DELTA_Z
SAVE REAL(KIND=1) X1
SAVE REAL(KIND=1) C3
I have used the latest FTN95 version 5.50 as you can see from the files *.lis.
Since there is nowhere any Save statement I wonder where the Save attributes come from. Is it just because the call of an internal subroutine is considered by FTN95 as a leave from the calling subroutine?
Best regards,
Klaus Lassmann
Compile.bat:
del comp.lis
del *.obj
ftn95 Test.f95 /Checkmate /Full_Debug /list /dump >> comp.lis
Test program
! ###############
Subroutine Test
! ###############
Implicit None
Real :: C3, x1, Delta_z
Integer :: Min_i, Max_i, m
Integer , Dimension (10) :: ifalll
! ------------------------------------------------------------------
m = 5
ifalll = 1
Min_i = Minval ( ifalll (1:m ))
Max_i = Maxval ( ifalll (1:m ))
C3 = 0.
Call Test_01
x1 = Delta_z
Write (*,*) x1, C3, Min_i, Max_i
! ########
Contains
! ########
Subroutine Test_01
Implicit None
Delta_z = 2.
End Subroutine Test_01
! ###################
End Subroutine Test
! ###################
Test.lis Silverfrost FTN95/WIN32 Ver 5.50.0 Test.F95 Sun Aug 8 12:37:53 2010
Compiler Options in Effect:
CHECKMATE COLOUR DELETE_OBJ_ON_ERROR DUMP FULL_DEBUG LIST MINIMISE_REBUILD NO_QUIT
NON_STANDARD SINGLE_THREADED
0001 AT 0
0002 ! ############### AT 0
0003 Subroutine Test AT 0
0004 ! ############### AT 3a
0005 AT 3a
0006 Implicit None AT 3a
0007 AT 3a
0008 Real :: C3, x1, Delta_z AT 3a
0009 AT 3a
0010 Integer :: Min_i, Max_i, m AT 3a
0011 AT 3a
0012 Integer , Dimension (10) :: ifalll AT 3a
0013 AT 3a
0014 ! ------------------------------------------------------------------ AT 3a
0015 AT 3a
0016 m = 5 AT 3a
0017 ifalll = 1 AT 45
0018 AT 6f
0019 Min_i = Minval ( ifalll (1:m )) AT 6f
0020 Max_i = Maxval ( ifalll (1:m )) AT b8
0021 AT 101
0022 C3 = 0. AT 101
0023 AT 10c
0024 Call Test_01 AT 10c
0025 AT 11a
0026 x1 = Delta_z AT 11a
0027 AT 12e
0028 Write (*,*) x1, C3, Min_i, Max_i AT 12e
Dump of all variables in TEST
Local Variables
SAVE INTEGER(KIND=3) IFALLL(10) @ 0 (at line 15)
SAVE INTEGER(KIND=3) M @ 40 (at line 11)
SAVE INTEGER(KIND=3) MAX_I @ 44 (at line 11)
SAVE INTEGER(KIND=3) MIN_I @ 48 (at line 11)
SAVE REAL(KIND=1) DELTA_Z @ 52 (at line 9)
SAVE REAL(KIND=1) X1 @ 56 (at line 9)
SAVE REAL(KIND=1) C3 @ 60 (at line 9)
Total stack size: 40 bytes
Total static size: 76 bytes
0029 AT 0
0030 ! ######## AT 0
0031 Contains AT 0
0032 ! ######## AT 0
0033 AT 0
0034 Subroutine Test_01 AT 0
0035 AT 1d
0036 Implicit None AT 1d
0037 Delta_z = 2. AT 1d
Dump of all variables in TEST_01
Total stack size: 16 bytes
Total static size: 76 bytes
0038 AT 39
0039 End Subroutine Test_01 AT 39
0040 AT 39
0041 AT 39
0042 ! ################### AT 39
0043 End Subroutine Test AT 39
0044 ! ################### AT 39
0045 AT 39
End of Compilation - Clocked 0.02 seconds