PR target/83368
[official-gcc.git] / gcc / testsuite / gfortran.dg / equiv_pure.f90
blob5b0ce419d2ac99c98e0383fd2922dd7fe045c6dd
1 ! { dg-do compile }
2 ! PR fortran/82796
3 ! Code contributed by ripero84 at gmail dot com
4 module eq
5 implicit none
6 integer :: n1, n2
7 integer, dimension(2) :: a
8 equivalence (a(1), n1)
9 equivalence (a(2), n2)
10 common /a/ a
11 end module eq
13 module m
14 use eq
15 implicit none
16 type, public :: t
17 integer :: i
18 end type t
19 end module m
21 module p
22 implicit none
23 contains
24 pure integer function d(h)
25 use m
26 implicit none
27 integer, intent(in) :: h
28 d = h
29 end function
30 end module p
32 module q
33 implicit none
34 contains
35 pure integer function d(h)
36 use m, only : t
37 implicit none
38 integer, intent(in) :: h
39 d = h
40 end function
41 end module q
43 module r
44 implicit none
45 contains
46 pure integer function d(h)
47 use m, only : a ! { dg-error "cannot be an EQUIVALENCE object" }
48 implicit none
49 integer, intent(in) :: h
50 d = h
51 end function
52 end module r