From f37d6478b3f9e5a7d0781547ce81d47d6385d426 Mon Sep 17 00:00:00 2001 From: David Minton Date: Sat, 3 Apr 2021 00:17:41 -0400 Subject: [PATCH] Fixed array size bug --- Makefile.Defines | 4 ++-- src/rmvs/rmvs_step.f90 | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile.Defines b/Makefile.Defines index cc15ec89a..75c4e0ad2 100644 --- a/Makefile.Defines +++ b/Makefile.Defines @@ -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 diff --git a/src/rmvs/rmvs_step.f90 b/src/rmvs/rmvs_step.f90 index b665ece45..b406afe9a 100644 --- a/src/rmvs/rmvs_step.f90 +++ b/src/rmvs/rmvs_step.f90 @@ -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 @@ -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(:)) @@ -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 \ No newline at end of file +end submodule s_rmvs_step