OSDN Git Service

gcc/fortran:
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / used_types_17.f90
1 ! { dg do-compile }
2 ! Tests the fix for PR31630, in which the association of the argument
3 ! of 'cmp' did not work.
4 !
5 ! Contributed by Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
6 !
7 module box_module
8   type box
9     integer :: m = 0
10   end type box
11 end module box_module
12
13 module sort_box_module
14 contains
15
16   subroutine heapsort_box(cmp)
17     interface
18        subroutine cmp(a)
19          use box_module
20          type(box) :: a
21        end subroutine cmp
22     end interface
23     optional :: cmp
24   end subroutine heapsort_box
25
26 end module sort_box_module
27
28
29 module boxarray_module
30   use box_module
31   implicit none
32
33   type boxarray
34     type(box), allocatable :: bxs(:)
35   end type boxarray
36 contains
37
38   subroutine boxarray_build_l(ba)
39     type(boxarray) :: ba
40     allocate(ba%bxs(1))
41   end subroutine boxarray_build_l
42
43   subroutine boxarray_sort()
44     use sort_box_module
45     call heapsort_box
46   end subroutine boxarray_sort
47
48 end module boxarray_module
49
50 ! { dg-final { cleanup-modules "box_module sort_box_module boxarray_module" } }