I have identified a problem with the OPTIMISE switch with FTN95. The following screen dump demonstrate this.
D:\contram\c7\tuba\ver16\opt_test>type test.inc integer4 M_vtype,M_Ftype,N_vtype,N_Ftype,N_Evlyrs parameter (M_vtype=10) parameter (M_Ftype=3) real4 dmfc_allyr(M_vtype,M_Ftype),dsfc_allyr(M_vtype,M_Ftype) common /cdata/N_vtype,N_Ftype,N_Evlyrs,dmfc_allyr,dsfc_allyr
D:\contram\c7\tuba\ver16\opt_test>type test.for C******************************************************************************* PROGRAM TEST C******************************************************************************* include 'test.inc'
c integer4 M_vtype,M_Ftype,N_vtype,N_Ftype,N_Evlyrs c parameter (M_vtype=10) c parameter (M_Ftype=3) c real4 dmfc_allyr(M_vtype,M_Ftype),dsfc_allyr(M_vtype,M_Ftype) c common /cdata/N_vtype,N_Ftype,N_Evlyrs,dmfc_allyr,dsfc_allyr
integer*4 S_dmfc,A_dmfc,A_dsfc
N_vtype=1
N_Ftype=2
N_Evlyrs=1
S_dmfc=8*N_vtype*N_Ftype*N_Evlyrs
call get_storage@(A_dmfc,s_dmfc)
call get_storage@(A_dsfc,s_dmfc)
call fuel_con_out(DCORE8(A_dmfc),DCORE8(A_dsfc))
call return_storage@(A_dsfc)
call return_storage@(A_dmfc)
end
C******************************************************************************* subroutine fuel_con_out(dm_fuel_con,ds_fuel_con) C*******************************************************************************
include 'test.inc'
c real8 dm_fuel_con(N_vtype,N_Evlyrs,N_Ftype) real8 ds_fuel_con(N_vtype,N_Evlyrs,N_Ftype) c dm_fuel_con(1,1,1)=1000.0 dm_fuel_con(1,1,2)=1000.0 call fuel_aggr(dm_fuel_con,dmfc_allyr) ds_fuel_con(1,1,1)=2000.0 ds_fuel_con(1,1,2)=2000.0 call fuel_aggr(ds_fuel_con,dsfc_allyr) write(,)'Aggr=',dsfc_allyr(1,1) return end C******************************************************************************* subroutine fuel_aggr(fuel_con,fc_allyr) C*******************************************************************************
include 'test.inc'
c integer4 v,y,f real4 fc_allyr(M_vtype,M_Ftype) real8 fuel_con(N_vtype,N_Evlyrs,N_Ftype) c do f=1,N_Ftype do v=1,N_vtype fc_allyr(v,f)=0.0 do y=1,N_Evlyrs fc_allyr(v,f)=fc_allyr(v,f)+fuel_con(v,y,f) if(f.eq.1.and.v.eq.1.and.y.eq.1) + write(,*)fc_allyr(v,f),fuel_con(v,y,f) end do end do end do return end
D:\contram\c7\tuba\ver16\opt_test>ftn95 test.for/link [FTN95/Win32 Ver. 4.8.2038 Copyright (C) Salford Software Ltd 1993-2005] Licensed to: Paul Chu Organisation: MOTT MACDONALD
NO ERRORS [<TEST> FTN95/Win32 v4.8.2038]
NO ERRORS [<FUEL_CON_OUT> FTN95/Win32 v4.8.2038]
NO ERRORS [<FUEL_AGGR> FTN95/Win32 v4.8.2038]
Creating executable: test.EXE
D:\contram\c7\tuba\ver16\opt_test>test 1000.00 1000.00000000 2000.00 2000.00000000 Aggr= 2000.00
D:\contram\c7\tuba\ver16\opt_test>ftn95 /intl /logl /save /zeroise /INHIBIT_OPT 36 /OPTIMISE test.for /link [FTN95/Win32 Ver. 4.8.2038 Copyright (C) Salford Software Ltd 1993-2005] Licensed to: Paul Chu Organisation: MOTT MACDONALD
NO ERRORS [<TEST> FTN95/Win32 v4.8.2038]
NO ERRORS [<FUEL_CON_OUT> FTN95/Win32 v4.8.2038]
NO ERRORS [<FUEL_AGGR> FTN95/Win32 v4.8.2038]
Creating executable: test.EXE
D:\contram\c7\tuba\ver16\opt_test>test 0.00000 1000.00000000 0.00000 2000.00000000 Aggr= 0.00000
The test program works fine without the OPTIMISE switch. However, with the /OPTIMISE switch it produces wrong results.
Ananda