xref: /llvm-project/flang/test/Semantics/bind-c09.f90 (revision ab7930bd9f088c4fcdfd438b5207a4052c9669b8)
1! RUN: %python %S/test_errors.py %s %flang_fc1
2! Check for C1553 and 18.3.4(1)
3
4function func1() result(res) bind(c)
5  ! ERROR: Interoperable function result may not have ALLOCATABLE or POINTER attribute
6  integer, pointer :: res
7end
8
9function func2() result(res) bind(c)
10  ! ERROR: Interoperable function result may not have ALLOCATABLE or POINTER attribute
11  integer, allocatable :: res
12end
13
14function func3() result(res) bind(c)
15  !ERROR: Interoperable function result must be scalar
16  integer :: res(2)
17end
18
19function func4() result(res) bind(c)
20  ! ERROR: Interoperable character function result must have length one
21  character(*) :: res
22end
23
24function func5(n) result(res) bind(c)
25  integer :: n
26  ! ERROR: Interoperable character function result must have length one
27  character(n) :: res
28end
29
30function func6() result(res) bind(c)
31  ! ERROR: Interoperable character function result must have length one
32  character(2) :: res
33end
34
35function func7() result(res) bind(c)
36  integer, parameter :: n = 1
37  character(n) :: res ! OK
38end
39
40function func8() result(res) bind(c)
41  ! ERROR: Interoperable function result may not have ALLOCATABLE or POINTER attribute
42  ! ERROR: Interoperable character function result must have length one
43  character(:), pointer :: res
44end
45
46function func9() result(res) bind(c)
47  ! ERROR: Interoperable function result may not be a coarray
48  integer :: res[10, *]
49end
50