xref: /llvm-project/flang/test/Semantics/resolve93.f90 (revision a56796157498a2642e5bec84f5247a3460f8222d)
1! RUN: %python %S/test_errors.py %s %flang_fc1
2subroutine s1()
3  character(10) str
4  character(10) str1
5  !ERROR: Cannot reference function 'str' as data
6  print *, str(1:9), str(7)
7  block
8    character(10) str2
9    character(10) str3
10    !ERROR: Cannot reference function 'str1' as data
11    print *, str1(1:9), str1(7)
12    print *, str2(1:9) ! substring is ok
13    !ERROR: 'str2' is not a callable procedure
14    print *, str2(7)
15    !ERROR: Cannot reference function 'str3' as data
16    print *, str3(7), str3(1:9)
17  end block
18end subroutine s1
19
20subroutine s2()
21  character(10) func
22  !ERROR: Cannot reference function 'func' as data
23  print *, func(7), func(1:9)
24end subroutine s2
25
26subroutine s3()
27  real(8) :: func
28  !ERROR: Cannot reference function 'func' as data
29  print *, func(7), func(1:6)
30end subroutine s3
31
32subroutine s4()
33  real(8) :: local
34  real(8) :: local1
35  !ERROR: Cannot reference function 'local' as data
36  print *, local(1:6), local(7)
37  !ERROR: Cannot reference function 'local1' as data
38  print *, local1(7), local1(1:6)
39end subroutine s4
40
41subroutine s5(arg)
42  integer :: iVar
43  external :: arg
44  iVar = loc(arg)
45end subroutine s5
46