Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gfortran.dg/use_13.f90 @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children | 84e7813d76e9 |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 ! { dg-do run } | |
2 ! | |
3 ! PR fortran/44360 | |
4 ! | |
5 ! Test-case based on a contribution of Vittorio Zecca. | |
6 ! | |
7 ! The used subroutine was not the use-associated but the host associated one! | |
8 ! The use-associated function/variable were already working properly. | |
9 ! | |
10 module m | |
11 integer :: var = 43 | |
12 contains | |
13 integer function fun() | |
14 fun = 42 | |
15 end function fun | |
16 subroutine fun2() | |
17 var = 44 | |
18 end subroutine fun2 | |
19 end module m | |
20 | |
21 module m2 | |
22 integer :: var = -2 | |
23 contains | |
24 subroutine test() | |
25 ! All procedures/variables below refer to the ones in module "m" | |
26 ! and not to the siblings in this module "m2". | |
27 use m | |
28 if (fun() /= 42) call abort() | |
29 if (var /= 43) call abort() | |
30 call fun2() | |
31 if (var /= 44) call abort() | |
32 end subroutine test | |
33 integer function fun() | |
34 call abort() | |
35 fun = -3 | |
36 end function fun | |
37 subroutine fun2() | |
38 call abort() | |
39 end subroutine fun2 | |
40 end module m2 | |
41 | |
42 use m2 | |
43 call test() | |
44 end |