libgfortran/ChangeLog:
[official-gcc.git] / gcc / testsuite / gfortran.dg / use_24.f90
blobb709347b0fd2308cc700b6db22403171f8b23c37
1 ! { dg-do run }
3 ! PR fortran/42769
4 ! The static resolution of A%GET used to be incorrectly simplified to MOD2's
5 ! MY_GET instead of the original MOD1's MY_GET, depending on the order in which
6 ! MOD1 and MOD2 were use-associated.
8 ! Original testcase by Salvator Filippone <sfilippone@uniroma2.it>
9 ! Reduced by Janus Weil <janus@gcc.gnu.org>
11 module mod1
12 type :: t1
13 contains
14 procedure, nopass :: get => my_get
15 end type
16 contains
17 subroutine my_get(i)
18 i = 2
19 end subroutine
20 end module
22 module mod2
23 contains
24 subroutine my_get(i) ! must have the same name as the function in mod1
25 i = 5
26 end subroutine
27 end module
30 call test1()
31 call test2()
33 contains
35 subroutine test1()
36 use mod2
37 use mod1
38 type(t1) :: a
39 call a%get(j)
40 if (j /= 2) call abort
41 end subroutine test1
43 subroutine test2()
44 use mod1
45 use mod2
46 type(t1) :: a
47 call a%get(j)
48 if (j /= 2) call abort
49 end subroutine test2
50 end