Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7a73eaa

Browse files
authored
fix: over-allocated arrays in test_horiz_interp (NOAA-GFDL#1607)
1 parent 180f866 commit 7a73eaa

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

test_fms/horiz_interp/test_horiz_interp.F90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,7 @@ subroutine test_assignment()
11311131
! this set up is usually done within horiz_interp_new
11321132
nlon_in = size(lon_in_1d(:))-1; nlat_in = size(lat_in_1d(:))-1
11331133
nlon_out = size(lon_out_1d(:))-1; nlat_out = size(lat_out_1d(:))-1
1134-
allocate(lon_src_1d(nlon_in), lat_src_1d(nlat_in))
1134+
allocate(lon_src_1d(nlon_in-1), lat_src_1d(nlat_in-1))
11351135
allocate(lon_dst_1d(nlon_out), lat_dst_1d(nlat_out))
11361136
do i = 1, nlon_in-1
11371137
lon_src_1d(i) = (lon_in_1d(i) + lon_in_1d(i+1)) * 0.5_lkind
@@ -1213,7 +1213,7 @@ subroutine test_assignment()
12131213
call horiz_interp_del(Interp_cp)
12141214
! 2dx1d
12151215
deallocate(lon_out_1D, lat_out_1D)
1216-
allocate(lon_out_1D(ni_dst+1), lat_out_1D(nj_dst+1))
1216+
allocate(lon_out_1D(ni_dst), lat_out_1D(nj_dst))
12171217
do i=1, ni_dst
12181218
lon_out_1d(i) = real(i-1, HI_TEST_KIND_) * dlon_dst + lon_dst_beg
12191219
enddo

0 commit comments

Comments
 (0)