Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / bind-c04.f90
bloba4aaffb239fde2a523b3e8d291c7b96a7ff8e2cf
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! Check for C1520
3 ! If proc-language-binding-spec (bind(c)) with NAME= is specified, then
4 ! proc-decl-list shall contain exactly one proc-decl, which shall neither have
5 ! the POINTER attribute nor be a dummy procedure.
7 subroutine sub(x, y)
9 interface
10 subroutine proc() bind(c)
11 end
12 end interface
14 abstract interface
15 !ERROR: An ABSTRACT interface may not have a BIND attribute with a name
16 subroutine aproc1() bind(c,name="foo")
17 end
18 subroutine aproc2() bind(c) ! ok
19 end
20 end interface
22 !Acceptable (as an extension)
23 procedure(proc), bind(c, name="aaa") :: pc1, pc2
25 !ERROR: A procedure pointer may not have a BIND attribute with a name
26 procedure(proc), bind(c, name="bbb"), pointer :: pc3
28 !ERROR: An internal or dummy procedure may not have a BIND(C,NAME=) binding label
29 procedure(proc), bind(c, name="ccc") :: x
31 procedure(proc), bind(c) :: pc4, pc5
33 !ERROR: A procedure pointer may not have a BIND attribute with a name
34 procedure(proc), bind(c, name="pc6"), pointer :: pc6
36 procedure(proc), bind(c), pointer :: pc7
38 procedure(proc), bind(c) :: y
40 !WARNING: Attribute 'BIND(C)' cannot be used more than once
41 !ERROR: A procedure pointer may not have a BIND attribute with a name
42 procedure(proc), bind(c, name="pc8"), bind(c), pointer :: pc8
44 end