xref: /llvm-project/flang/test/Lower/bindc_procs.f90 (revision d9250061e10b82f82d9833009f6565775578ee58)
1! RUN: bbc -emit-fir %s -o - | FileCheck %s
2
3! CHECK-DAG: func.func private @proc1() attributes {fir.bindc_name = "proc1", fir.proc_attrs = #fir.proc_attrs<bind_c>}
4module decl1
5  interface
6     subroutine proc_iface() bind(C)
7     end subroutine proc_iface
8  end interface
9  procedure (proc_iface) PrOc1
10end module decl1
11subroutine test1(x)
12  use decl1
13  call PrOc1
14end subroutine test1
15
16! CHECK-DAG: func.func private @proc2() attributes {fir.bindc_name = "proc2", fir.proc_attrs = #fir.proc_attrs<bind_c>}
17module decl2
18  interface
19     subroutine proc_iface() bind(C)
20     end subroutine proc_iface
21  end interface
22end module decl2
23subroutine test2(x)
24  use decl2
25  procedure (proc_iface) PrOc2
26  call PrOc2
27end subroutine test2
28
29! CHECK-DAG: func.func private @func3() -> f32 attributes {fir.bindc_name = "func3", fir.proc_attrs = #fir.proc_attrs<bind_c>}
30module decl3
31  interface
32     real function func_iface() bind(C)
33     end function func_iface
34  end interface
35  procedure (func_iface) FuNc3
36end module decl3
37subroutine test3(x)
38  use decl3
39  real :: x
40  x = FuNc3()
41end subroutine test3
42
43! CHECK-DAG: func.func private @func4() -> f32 attributes {fir.bindc_name = "func4", fir.proc_attrs = #fir.proc_attrs<bind_c>}
44module decl4
45  interface
46     real function func_iface() bind(C)
47     end function func_iface
48  end interface
49end module decl4
50subroutine test4(x)
51  use decl4
52  procedure (func_iface) FuNc4
53  real :: x
54  x = FuNc4()
55end subroutine test4
56
57