Debian Codegraph @

gcc/testsuite/gfortran.dg/associate_51.f90

raw
1 ! { dg-do compile }
2 !
3 ! PR fortran/92994
4 !
5 ! Contributed by G. Steinmetz
6 !
7 recursive function f() result(z)
8 associate (y1 => f())
9 end associate
10 associate (y2 => f) ! { dg-error "is a procedure name" }
11 end associate
12 end
13
14 recursive function f2()
15 associate (y1 => f2()) ! { dg-error "Invalid association target" }
16 end associate ! { dg-error "Expecting END FUNCTION statement" }
17 end
18
19 recursive function f3()
20 associate (y1 => f3)
21 print *, y1() ! { dg-error "Expected array subscript" }
22 end associate
23 associate (y2 => f3) ! { dg-error "Associate-name 'y2' at \\(1\\) is used as array" }
24 print *, y2(1)
25 end associate
26 end
27
28 subroutine p2
29 type t
30 end type
31 type(t) :: z = t()
32 associate (y => t())
33 end associate
34 end
35
36 subroutine p3
37 procedure() :: g
38 associate (y => g) ! { dg-error "is a procedure name" }
39 end associate
40 end
41
42 subroutine p4
43 external :: g
44 associate (y => g) ! { dg-error "is a procedure name" }
45 end associate
46 end
47
48 recursive subroutine s
49 associate (y => s) ! { dg-error "is a procedure name" }
50 end associate
51 end
52
53 recursive subroutine s2
54 associate (y => (s2)) ! { dg-error "is a procedure name" }
55 end associate
56 end
57
58 program p
59 associate (y => (p)) ! { dg-error "Invalid association target" }
60 end associate ! { dg-error "Expecting END PROGRAM statement" }
61 end