3 ! Test the fix for PR82375
5 ! Based on contribution by Ian Chivers <ian@rhymneyconsulting.co.uk>
7 module precision_module
9 integer, parameter :: sp = selected_real_kind(6, 37)
10 integer, parameter :: dp = selected_real_kind(15, 307)
11 integer, parameter :: qp = selected_real_kind( 30, 291)
12 end module precision_module
18 integer, kind :: real_kind
19 real (kind=real_kind) :: n
20 type (link(real_kind)), pointer :: next => NULL()
25 function push_8 (self, arg) result(current)
27 type (link(real_kind=dp)), pointer :: self
28 type (link(real_kind=dp)), pointer :: current
30 if (associated (self)) then
32 do while (associated (current%next))
33 current => current%next
36 allocate (current%next)
37 current => current%next
44 current%next => NULL ()
47 function pop_8 (self) result(res)
48 type (link(real_kind=dp)), pointer :: self
49 type (link(real_kind=dp)), pointer :: current => NULL()
50 type (link(real_kind=dp)), pointer :: previous => NULL()
54 if (associated (self)) then
56 do while (associated (current) .and. associated (current%next))
58 current => current%next
61 previous%next => NULL ()
64 if (associated (self, current)) then
73 end module link_module
79 integer, parameter :: wp = dp
80 type (link(real_kind=wp)), pointer :: root => NULL()
81 type (link(real_kind=wp)), pointer :: current
83 current => push_8 (root, 1.0_8)
84 current => push_8 (root, 2.0_8)
85 current => push_8 (root, 3.0_8)
87 if (int (pop_8 (root)) .ne. 3) call abort
88 if (int (pop_8 (root)) .ne. 2) call abort
89 if (int (pop_8 (root)) .ne. 1) call abort
90 if (int (pop_8 (root)) .ne. 0) call abort