| 1 |
!{ dg-do run } |
| 2 |
! |
| 3 |
! Check that the finalizer is called on unused variables too. |
| 4 |
! Contributed by LXYAN <[email protected]> |
| 5 |
|
| 6 |
module pr118730_mod |
| 7 |
implicit none |
| 8 |
|
| 9 |
logical :: finished = .FALSE. |
| 10 |
|
| 11 |
type :: test_type |
| 12 |
integer::test |
| 13 |
contains |
| 14 |
final :: finalize |
| 15 |
end type test_type |
| 16 |
|
| 17 |
contains |
| 18 |
subroutine finalize(this) |
| 19 |
type(test_type), intent(inout) :: this |
| 20 |
finished = .TRUE. |
| 21 |
end subroutine finalize |
| 22 |
end module pr118730_mod |
| 23 |
|
| 24 |
program pr118730 |
| 25 |
use :: pr118730_mod |
| 26 |
implicit none |
| 27 |
|
| 28 |
block |
| 29 |
type(test_type) :: test |
| 30 |
end block |
| 31 |
|
| 32 |
if (.NOT. finished) error stop 1 |
| 33 |
end program pr118730 |