brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 93be221 Raw
27 lines · plain
1! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s2! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir %s -o - | FileCheck %s3 4! Test intrinsic module procedure c_funloc5 6! CHECK-LABEL: func.func @_QPtest() {7! CHECK:         %[[VAL_1:.*]] = fir.address_of(@_QPfoo) : (!fir.ref<i32>) -> ()8! CHECK:         %[[VAL_2:.*]] = fir.emboxproc %[[VAL_1]] : ((!fir.ref<i32>) -> ()) -> !fir.boxproc<(!fir.ref<i32>) -> ()>9! CHECK:         %[[VAL_3:.*]] = fir.alloca !fir.type<_QM__fortran_builtinsT__builtin_c_funptr{__address:i64}>10! CHECK-DAG:         %[[VAL_4:.*]] = fir.box_addr %[[VAL_2]] : (!fir.boxproc<(!fir.ref<i32>) -> ()>) -> ((!fir.ref<i32>) -> ())11! CHECK-DAG:         %[[VAL_5:.*]] = fir.convert %[[VAL_4]] : ((!fir.ref<i32>) -> ()) -> i6412! CHECK-DAG:         %[[VAL_7:.*]] = fir.coordinate_of %[[VAL_3]], __address : (!fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_funptr{__address:i64}>>) -> !fir.ref<i64>13! CHECK:         fir.store %[[VAL_5]] to %[[VAL_7]] : !fir.ref<i64>14 15subroutine test()16  use iso_c_binding17  interface18    subroutine foo(i)19      integer :: i20    end21  end interface22 23  type(c_funptr) :: tmp_cptr24 25  tmp_cptr = c_funloc(foo)26end27