Debian Codegraph @

gcc/testsuite/gfortran.dg/associate_53.f90

raw
1 ! { dg-do compile }
2 !
3 ! PR fortran/93363
4 !
5 ! Contributed by G. Steinmetz
6
7 program p
8 type t
9 integer :: a
10 end type
11 type(t) :: z
12 z = t(1)
13 associate (var1 => t) ! { dg-error "Derived type 't' cannot be used as a variable" }
14 end associate
15 end
16
17 subroutine sub
18 if (f() /= 1) stop
19 associate (var2 => f) ! { dg-error "Associating entity 'f' at .1. is a procedure name" }
20 end associate
21 block
22 block
23 associate (var2a => f) ! { dg-error "Associating entity 'f' at .1. is a procedure name" }
24 end associate
25 end block
26 end block
27 contains
28 integer function f()
29 f = 1
30 associate (var3 => f)
31 end associate
32 block
33 block
34 associate (var4 => f)
35 end associate
36 end block
37 end block
38 end
39 integer recursive function f2() result(res)
40 res = 1
41 associate (var5 => f2) ! { dg-error "Associating entity 'f2' at .1. is a procedure name" }
42 end associate
43 block
44 block
45 associate (var6 => f2) ! { dg-error "Associating entity 'f2' at .1. is a procedure name" }
46 end associate
47 end block
48 end block
49 end
50 subroutine subsub
51 associate (var7 => f) ! { dg-error "Associating entity 'f' at .1. is a procedure name" }
52 end associate
53 block
54 block
55 associate (var8 => f) ! { dg-error "Associating entity 'f' at .1. is a procedure name" }
56 end associate
57 end block
58 end block
59 end
60 end
61
62 subroutine sub2
63 interface g
64 procedure s
65 end interface
66 associate (var9 => g) ! { dg-error "Associating entity 'g' at .1. is a procedure name" }
67 end associate
68 contains
69 subroutine s
70 end
71 end