3 ! Test the fix for PR104272 in which allocate caused an unwanted finalization
5 ! Contributed by Kai Germaschewski <kai.germaschewski@gmail.com>
10 type, abstract
, public
:: solver_base_t
11 end type solver_base_t
13 type, public
, extends(solver_base_t
) :: solver_gpu_t
14 complex, dimension(:), allocatable
:: x
16 final
:: solver_gpu_final
19 type, public
, extends(solver_gpu_t
) :: solver_sparse_gpu_t
21 final
:: solver_sparse_gpu_final
22 end type solver_sparse_gpu_t
24 integer :: final_counts
= 0
28 impure elemental
subroutine solver_gpu_final(this
)
29 type(solver_gpu_t
), intent(INOUT
) :: this
30 final_counts
= final_counts
+ 1
31 end subroutine solver_gpu_final
33 impure elemental
subroutine solver_sparse_gpu_final(this
)
34 type(solver_sparse_gpu_t
), intent(INOUT
) :: this
35 final_counts
= final_counts
+ 10
36 end subroutine solver_sparse_gpu_final
44 class(solver_base_t
), dimension(:), allocatable
:: solver
46 allocate(solver_sparse_gpu_t
:: solver(2))
48 if (final_counts
.ne
. 0) stop 1
56 if (final_counts
.ne
. 22) stop 2 ! Scalar finalizers for rank 1/size 2