xref: /llvm-project/flang/test/Lower/HLFIR/bindc_empty_name.f90 (revision b797a6aede3dbdf7e2287e4fbde13f2550961d96)
1! Test that lowering makes a difference between NAME="" and no NAME
2! in BIND(C). See Fortran 2018 standard 18.10.2 point 2.
3! BIND(C, NAME="") implies there is no binding label, meaning that
4! the Fortran mangled name has to be used.
5! RUN: bbc -emit-hlfir %s -o - | FileCheck %s
6
7!CHECK: func.func @_QPfoo(%{{.*}}: !fir.ref<i16>
8subroutine foo(x) bind(c, name="")
9  integer(2) :: x
10end subroutine
11
12!CHECK: func.func @bar(%{{.*}}: !fir.ref<i32>
13subroutine foo(x) bind(c, name="bar")
14  integer(4) :: x
15end subroutine
16
17!CHECK: func.func @_QMinamodule1Pfoo(%{{.*}}: !fir.ref<i64>
18module inamodule1
19contains
20subroutine foo(x) bind(c, name="")
21  integer(8) :: x
22end subroutine
23end module
24