Skip to content

Commit

Permalink
Issue #922: fixed side-effect about advancing an iterator inside of a…
Browse files Browse the repository at this point in the history
…n assertion (src/common/cp_linked_list.fypp).
  • Loading branch information
hfp committed Jun 24, 2020
1 parent e7c6bfc commit 4c752ed
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/common/cp_linked_list.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -614,14 +614,16 @@ FUNCTION cp_sll_${nametype1[i]}$_to_array(sll) RESULT(res)
CHARACTER(len=*), PARAMETER :: routineN='cp_sll_${nametype1[i]}$_to_array',&
routineP=moduleN//':'//routineN
INTEGER :: len,i
LOGICAL :: ok
TYPE(cp_sll_${nametype1[i]}$_type), POINTER :: iter

len=cp_sll_${nametype1[i]}$_get_length(sll)
ALLOCATE(res(len))
iter => sll
DO i=1,len
res(i)${arrayEl[i]}$ ${arrayeq[i]}$ iter%first_el
CPASSERT(cp_sll_${nametype1[i]}$_next(iter).OR.i==len)
ok = cp_sll_${nametype1[i]}$_next(iter)
CPASSERT(ok .OR. i == len)
END DO
END FUNCTION cp_sll_${nametype1[i]}$_to_array
#:endfor
Expand Down

0 comments on commit 4c752ed

Please sign in to comment.