OSDN Git Service

PR debug/43329
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / used_types_11.f90
1 ! { dg-do compile }
2 ! Tests the patch for PR 29641, in which an ICE would occur with
3 ! the ordering of USE statements below.
4 !
5 ! Contributed by Jakub Jelinek <jakub@gcc.gnu.org>
6 !
7 module A
8   type :: T
9     integer :: u
10   end type T
11 end module A
12
13 module B
14 contains
15   function foo()
16     use A
17     type(T), pointer :: foo
18     nullify (foo)
19   end function foo
20 end module B
21
22 subroutine bar()
23   use B             ! The order here is important
24   use A             ! If use A comes before use B, it works
25   type(T), pointer :: x
26   x => foo()
27 end subroutine bar
28
29   use B
30   use A
31   type(T), pointer :: x
32   type(T), target  :: y
33   x => y
34   print *, associated (x)
35   x => foo ()
36   print *, associated (x)
37 end
38 ! { dg-final { cleanup-modules "A B" } }