1! RUN: %python %S/test_errors.py %s %flang_fc1
2! test bind(c) name conflict
3
4module m
5
6  integer :: x, y, z, w, i, j, k
7
8  !ERROR: Two entities have the same BIND(C) name 'aa'
9  common /blk1/ x, /blk2/ y
10  bind(c, name="aa") :: /blk1/, /blk2/
11
12  integer :: t
13  !ERROR: Two entities have the same BIND(C) name 'bb'
14  common /blk3/ z
15  bind(c, name="bb") :: /blk3/, t
16
17  integer :: t2
18  !ERROR: Two entities have the same BIND(C) name 'cc'
19  common /blk4/ w
20  bind(c, name="cc") :: t2, /blk4/
21
22  !ERROR: The entity 'blk5' has multiple BIND names
23  common /blk5/ i
24  bind(c, name="dd") :: /blk5/
25  bind(c, name="ee") :: /blk5/
26
27  !ERROR: Two entities have the same BIND(C) name 'ff'
28  common /blk6/ j, /blk7/ k
29  bind(c, name="ff") :: /blk6/
30  bind(c, name="ff") :: /blk7/
31
32  !ERROR: The entity 's1' has multiple BIND names
33  integer :: s1
34  bind(c, name="gg") :: s1
35  bind(c, name="hh") :: s1
36
37  !ERROR: Two entities have the same BIND(C) name 'ii'
38  integer :: s2, s3
39  bind(c, name="ii") :: s2
40  bind(c, name="ii") :: s3
41
42  !ERROR: The entity 's4' has multiple BIND names
43  integer, bind(c, name="ss1") :: s4
44  bind(c, name="jj") :: s4
45
46  !ERROR: The entity 's5' has multiple BIND names
47  bind(c, name="kk") :: s5
48  integer, bind(c, name="ss2") :: s5
49
50end
51
52subroutine common1()
53  real :: x
54  common /com/ x
55  bind(c, name='xcom') /com/ ! no error
56end subroutine
57
58subroutine common2()
59  real :: x
60  common /com/ x
61  bind(c, name='xcom') /com/ ! no error
62end subroutine
63
64module a
65  integer, bind(c, name="int") :: i
66end module
67
68module b
69  !ERROR: Two entities have the same BIND(C) name 'int'
70  integer, bind(c, name="int") :: i
71end module
72