Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Fixed array size bug
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Apr 3, 2021
1 parent 53ca964 commit f37d647
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Makefile.Defines
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ GMEM = -fsanitize=undefined -fsanitize=address -fsanitize=leak
GWARNINGS = -Wall -Warray-bounds -Wimplicit-interface -Wextra -Warray-temporaries


#FORTRAN = gfortran
#FFLAGS = -ffree-line-length-none $(GDEBUG)
FORTRAN = gfortran
FFLAGS = -ffree-line-length-none $(GDEBUG) $(GMEM)
AR = ar

# DO NOT include in CFLAGS the "-c" option to compile object only
Expand Down
8 changes: 4 additions & 4 deletions src/rmvs/rmvs_step.f90
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,14 @@ module subroutine rmvs_step_make_planetocentric(self, cb, tp, config)
integer(I4B) :: i, j
logical, dimension(:), allocatable :: encmask

associate(pl => self, npl => self%nbody, nenc => self%nenc, tpenc => self%tpenc, cbenc => self%cbenc, &
associate(pl => self, npl => self%nbody, ntp => tp%nbody, nenc => self%nenc, tpenc => self%tpenc, cbenc => self%cbenc, &
plenc => self%plenc, GMpl => self%Gmass)

do i = 1, npl
if (nenc(i) == 0) cycle
! There are inner encounters with this planet
if (allocated(encmask)) deallocate(encmask)
allocate(encmask(nenc(i)))
allocate(encmask(ntp))
encmask(:) = tp%plencP(:) == i

! Save the index value of the planet corresponding to this encounter
Expand Down Expand Up @@ -303,7 +303,7 @@ module subroutine rmvs_step_end_planetocentric(self, cb, tp)
allocate(tpind(nenc(i)))
! Index array of encountering test particles
if (allocated(encmask)) deallocate(encmask)
allocate(encmask(nenc(i)))
allocate(encmask(ntp))
encmask(:) = tp%plencP(:) == i
tpind(:) = pack([(j,j=1,ntp)], encmask(:))

Expand Down Expand Up @@ -331,4 +331,4 @@ module subroutine rmvs_step_end_planetocentric(self, cb, tp)
return
end subroutine rmvs_step_end_planetocentric

end submodule s_rmvs_step
end submodule s_rmvs_step

0 comments on commit f37d647

Please sign in to comment.