annotate gcc/testsuite/gfortran.dg/import.f90 @ 132:d34655255c78

update gcc-8.2
author mir3636
date Thu, 25 Oct 2018 10:21:07 +0900
parents 84e7813d76e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ! { dg-do run }
kono
parents:
diff changeset
2 ! Test whether import works
kono
parents:
diff changeset
3 ! PR fortran/29601
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 subroutine test(x)
kono
parents:
diff changeset
6 type myType3
kono
parents:
diff changeset
7 sequence
kono
parents:
diff changeset
8 integer :: i
kono
parents:
diff changeset
9 end type myType3
kono
parents:
diff changeset
10 type(myType3) :: x
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
11 if(x%i /= 7) STOP 1
111
kono
parents:
diff changeset
12 x%i = 1
kono
parents:
diff changeset
13 end subroutine test
kono
parents:
diff changeset
14
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 subroutine bar(x,y)
kono
parents:
diff changeset
17 type myType
kono
parents:
diff changeset
18 sequence
kono
parents:
diff changeset
19 integer :: i
kono
parents:
diff changeset
20 end type myType
kono
parents:
diff changeset
21 type(myType) :: x
kono
parents:
diff changeset
22 integer(8) :: y
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
23 if(y /= 8) STOP 2
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
24 if(x%i /= 2) STOP 3
111
kono
parents:
diff changeset
25 x%i = 5
kono
parents:
diff changeset
26 y = 42
kono
parents:
diff changeset
27 end subroutine bar
kono
parents:
diff changeset
28
kono
parents:
diff changeset
29 module testmod
kono
parents:
diff changeset
30 implicit none
kono
parents:
diff changeset
31 integer, parameter :: kind = 8
kono
parents:
diff changeset
32 type modType
kono
parents:
diff changeset
33 real :: rv
kono
parents:
diff changeset
34 end type modType
kono
parents:
diff changeset
35 interface
kono
parents:
diff changeset
36 subroutine other(x,y)
kono
parents:
diff changeset
37 import
kono
parents:
diff changeset
38 real(kind) :: x
kono
parents:
diff changeset
39 type(modType) :: y
kono
parents:
diff changeset
40 end subroutine
kono
parents:
diff changeset
41 end interface
kono
parents:
diff changeset
42 end module testmod
kono
parents:
diff changeset
43
kono
parents:
diff changeset
44 program foo
kono
parents:
diff changeset
45 integer, parameter :: dp = 8
kono
parents:
diff changeset
46 type myType
kono
parents:
diff changeset
47 sequence
kono
parents:
diff changeset
48 integer :: i
kono
parents:
diff changeset
49 end type myType
kono
parents:
diff changeset
50 type myType3
kono
parents:
diff changeset
51 sequence
kono
parents:
diff changeset
52 integer :: i
kono
parents:
diff changeset
53 end type myType3
kono
parents:
diff changeset
54 interface
kono
parents:
diff changeset
55 subroutine bar(x,y)
kono
parents:
diff changeset
56 import
kono
parents:
diff changeset
57 type(myType) :: x
kono
parents:
diff changeset
58 integer(dp) :: y
kono
parents:
diff changeset
59 end subroutine bar
kono
parents:
diff changeset
60 subroutine test(x)
kono
parents:
diff changeset
61 import :: myType3
kono
parents:
diff changeset
62 import myType3 ! { dg-warning "already IMPORTed from" }
kono
parents:
diff changeset
63 type(myType3) :: x
kono
parents:
diff changeset
64 end subroutine test
kono
parents:
diff changeset
65 end interface
kono
parents:
diff changeset
66
kono
parents:
diff changeset
67 type(myType) :: y
kono
parents:
diff changeset
68 type(myType3) :: z
kono
parents:
diff changeset
69 integer(8) :: i8
kono
parents:
diff changeset
70 y%i = 2
kono
parents:
diff changeset
71 i8 = 8
kono
parents:
diff changeset
72 call bar(y,i8)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
73 if(y%i /= 5 .or. i8/= 42) STOP 4
111
kono
parents:
diff changeset
74 z%i = 7
kono
parents:
diff changeset
75 call test(z)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
76 if(z%i /= 1) STOP 5
111
kono
parents:
diff changeset
77 end program foo