xref: /llvm-project/flang/test/Semantics/bind-c16.f90 (revision f3c227b797c19b1bc27f079ebcb0d5581b57950f)
1!RUN: %flang_fc1 -fdebug-dump-symbols %s 2>&1 | FileCheck %s
2!CHECK: p1a, BIND(C), EXTERNAL, PUBLIC (Subroutine): ProcEntity s1 bindName:p1a
3!CHECK: p1b, BIND(C), EXTERNAL, PUBLIC (Subroutine): ProcEntity s1 bindName:p1b
4!CHECK: p1c, BIND(C), EXTERNAL, PUBLIC (Subroutine): ProcEntity s1 bindName:P1c
5!CHECK: p2a, BIND(C), EXTERNAL, PUBLIC (Subroutine): ProcEntity s2 bindName:p2a
6!CHECK: p2b, BIND(C), EXTERNAL, PUBLIC (Subroutine): ProcEntity s2 bindName:p2b
7!CHECK: p2c, BIND(C), EXTERNAL, PUBLIC (Subroutine): ProcEntity s2 bindName:P2c
8!CHECK: p3a, BIND(C), EXTERNAL, PUBLIC (Subroutine): ProcEntity s3 bindName:p3a
9!CHECK: p3b, BIND(C), EXTERNAL, PUBLIC (Subroutine): ProcEntity s3 bindName:p3b
10!CHECK: p3c, BIND(C), EXTERNAL, PUBLIC (Subroutine): ProcEntity s3 bindName:P3c
11module m1
12  procedure(s1) :: p1a
13  procedure(s1), bind(c) :: p1b
14  procedure(s1), bind(c,name='P1c') :: p1c
15  procedure(s2) :: p2a
16  procedure(s2), bind(c) :: p2b
17  procedure(s2), bind(c,name='P2c') :: p2c
18  procedure(s3) :: p3a
19  procedure(s3), bind(c) :: p3b
20  procedure(s3), bind(c,name='P3c') :: p3c
21 contains
22  subroutine s1() bind(c)
23  end
24  subroutine s2() bind(c,name='')
25  end
26  subroutine s3() bind(c,name='foo')
27  end
28end
29
30!CHECK: p1a, BIND(C), EXTERNAL, PUBLIC (Subroutine): ProcEntity s1 bindName:p1a
31!CHECK: p1b, BIND(C), EXTERNAL, PUBLIC (Subroutine): ProcEntity s1 bindName:p1b
32!CHECK: p1c, BIND(C), EXTERNAL, PUBLIC (Subroutine): ProcEntity s1 bindName:P1c
33!CHECK: p2a, BIND(C), EXTERNAL, PUBLIC (Subroutine): ProcEntity s2 bindName:p2a
34!CHECK: p2b, BIND(C), EXTERNAL, PUBLIC (Subroutine): ProcEntity s2 bindName:p2b
35!CHECK: p2c, BIND(C), EXTERNAL, PUBLIC (Subroutine): ProcEntity s2 bindName:P2c
36!CHECK: p3a, BIND(C), EXTERNAL, PUBLIC (Subroutine): ProcEntity s3 bindName:p3a
37!CHECK: p3b, BIND(C), EXTERNAL, PUBLIC (Subroutine): ProcEntity s3 bindName:p3b
38!CHECK: p3c, BIND(C), EXTERNAL, PUBLIC (Subroutine): ProcEntity s3 bindName:P3c
39module m2
40  interface
41    subroutine s1() bind(c)
42    end
43    subroutine s2() bind(c,name='')
44    end
45    subroutine s3() bind(c,name='foo')
46    end
47  end interface
48  procedure(s1) :: p1a
49  procedure(s1), bind(c) :: p1b
50  procedure(s1), bind(c,name='P1c') :: p1c
51  procedure(s2) :: p2a
52  procedure(s2), bind(c) :: p2b
53  procedure(s2), bind(c,name='P2c') :: p2c
54  procedure(s3) :: p3a
55  procedure(s3), bind(c) :: p3b
56  procedure(s3), bind(c,name='P3c') :: p3c
57end
58
59!CHECK: p1a, BIND(C), EXTERNAL, PUBLIC (Subroutine): ProcEntity s1 bindName:p1a
60!CHECK: p1b, BIND(C), EXTERNAL, PUBLIC (Subroutine): ProcEntity s1 bindName:p1b
61!CHECK: p1c, BIND(C), EXTERNAL, PUBLIC (Subroutine): ProcEntity s1 bindName:P1c
62!CHECK: p2a, BIND(C), EXTERNAL, PUBLIC (Subroutine): ProcEntity s2 bindName:p2a
63!CHECK: p2b, BIND(C), EXTERNAL, PUBLIC (Subroutine): ProcEntity s2 bindName:p2b
64!CHECK: p2c, BIND(C), EXTERNAL, PUBLIC (Subroutine): ProcEntity s2 bindName:P2c
65!CHECK: p3a, BIND(C), EXTERNAL, PUBLIC (Subroutine): ProcEntity s3 bindName:p3a
66!CHECK: p3b, BIND(C), EXTERNAL, PUBLIC (Subroutine): ProcEntity s3 bindName:p3b
67!CHECK: p3c, BIND(C), EXTERNAL, PUBLIC (Subroutine): ProcEntity s3 bindName:P3c
68module m3
69  procedure(s1) :: p1a
70  procedure(s1), bind(c) :: p1b
71  procedure(s1), bind(c,name='P1c') :: p1c
72  procedure(s2) :: p2a
73  procedure(s2), bind(c) :: p2b
74  procedure(s2), bind(c,name='P2c') :: p2c
75  procedure(s3) :: p3a
76  procedure(s3), bind(c) :: p3b
77  procedure(s3), bind(c,name='P3c') :: p3c
78  interface
79    subroutine s1() bind(c)
80    end
81    subroutine s2() bind(c,name='')
82    end
83    subroutine s3() bind(c,name='foo')
84    end
85  end interface
86end
87
88!CHECK: cdef01, BIND(C), PUBLIC size=4 offset=0: ObjectEntity type: REAL(4) bindName:cDef01 CDEFINED
89module m4
90  real, bind(c, name='cDef01', cdefined) :: cdef01
91end
92