aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/associate_53.f90
blob: 5b56af38e47d5d84f4a6329fd3533c32faad6d57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
! { dg-do compile }
!
! PR fortran/93363
!
! Contributed by G. Steinmetz

program p
   type t
      integer :: a
   end type
   type(t) :: z
   z = t(1)
   associate (var1 => t)  ! { dg-error "Derived type 't' cannot be used as a variable" }
   end associate
end

subroutine sub
   if (f() /= 1) stop
   associate (var2 => f)  ! { dg-error "Associating entity 'f' at .1. is a procedure name" }
   end associate
   block
      block
        associate (var2a => f)  ! { dg-error "Associating entity 'f' at .1. is a procedure name" }
        end associate
      end block
    end block
contains
   integer function f()
      f = 1
      associate (var3 => f)
      end associate
      block
        block
          associate (var4 => f)
          end associate
        end block
      end block
   end
   integer recursive function f2() result(res)
      res = 1
      associate (var5 => f2)  ! { dg-error "Associating entity 'f2' at .1. is a procedure name" }
      end associate
      block
        block
          associate (var6 => f2)  ! { dg-error "Associating entity 'f2' at .1. is a procedure name" }
          end associate
        end block
      end block
   end
   subroutine subsub
      associate (var7 => f)  ! { dg-error "Associating entity 'f' at .1. is a procedure name" }
      end associate
      block
        block
          associate (var8 => f)  ! { dg-error "Associating entity 'f' at .1. is a procedure name" }
          end associate
        end block
      end block
   end
end

subroutine sub2
   interface g
      procedure s
   end interface
   associate (var9 => g)  ! { dg-error "Associating entity 'g' at .1. is a procedure name" }
   end associate
contains
   subroutine s
   end
end