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

Commit

Permalink
Fixed bad spill operation on the symba_kinship type
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Oct 13, 2021
1 parent c3ef158 commit aa37c3d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/symba/symba_util.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1102,6 +1102,7 @@ module subroutine symba_util_spill_arr_kin(keeps, discards, lspill_list, ldestru
logical, intent(in) :: ldestructive !! Logical flag indicating whether or not this operation should alter the keeps array or not
! Internals
integer(I4B) :: nspill, nkeep, nlist
type(symba_kinship), dimension(:), allocatable :: tmp

nkeep = count(.not.lspill_list(:))
nspill = count(lspill_list(:))
Expand All @@ -1118,7 +1119,9 @@ module subroutine symba_util_spill_arr_kin(keeps, discards, lspill_list, ldestru
discards(:) = pack(keeps(1:nlist), lspill_list(1:nlist))
if (ldestructive) then
if (nkeep > 0) then
keeps(:) = pack(keeps(1:nlist), .not. lspill_list(1:nlist))
allocate(tmp(nkeep))
tmp(:) = pack(keeps(1:nlist), .not. lspill_list(1:nlist))
call move_alloc(tmp, keeps)
else
deallocate(keeps)
end if
Expand Down

0 comments on commit aa37c3d

Please sign in to comment.