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

Commit

Permalink
Fixed bug that was causing a segfault when n decreased. Moved the all…
Browse files Browse the repository at this point in the history
…ocation of the temporary index array out of the if statement
  • Loading branch information
daminton committed Oct 6, 2021
1 parent 4219f95 commit 1d41b68
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/util/util_index_array.f90
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ module subroutine util_index_array(ind_arr, n)
nold = 0
end if

allocate(itmp(n))
if (n >= nold) then
allocate(itmp(n))
if (nold > 0) itmp(1:nold) = ind_arr(1:nold)
itmp(nold+1:n) = [(i, i = nold + 1, n)]
call move_alloc(itmp, ind_arr)
Expand Down

0 comments on commit 1d41b68

Please sign in to comment.