Debian Codegraph @

flang/test/Lower/HLFIR/type-bound-proc-tdesc.f90

raw
1 ! Test lowering of type bound procedure in the derived type descriptors (that
2 ! are compiler generated constant structure constructors).
3 ! RUN: bbc -emit-fir -hlfir -o - %s | FileCheck %s
4
5 module type_bound_proc_tdesc
6 type :: t
7 contains
8 procedure, nopass :: simple => simple_impl
9 procedure, nopass :: return_char => return_char_impl
10 end type
11
12 interface
13 function return_char_impl()
14 character(10) :: return_char_impl
15 end function
16 subroutine simple_impl()
17 end subroutine
18 end interface
19 end
20 use type_bound_proc_tdesc
21 type(t) :: a
22 end
23
24 ! CHECK-LABEL: fir.global {{.*}} @_QMtype_bound_proc_tdescE.v.t
25 ! CHECK: fir.address_of(@_QPreturn_char_impl) : (!fir.ref<!fir.char<1,10>>, index) -> !fir.boxchar<1>
26 ! CHECK: %[[VAL_8:.*]] = fir.extract_value %{{.*}}, [0 : index] : (tuple<!fir.boxproc<() -> ()>, i64>) -> !fir.boxproc<() -> ()>
27 ! CHECK: fir.box_addr %[[VAL_8]] : (!fir.boxproc<() -> ()>) -> (() -> ())
28 ! ...
29 ! CHECK: %[[VAL_25:.*]] = fir.address_of(@_QPsimple_impl) : () -> ()
30 ! CHECK: %[[VAL_26:.*]] = fir.emboxproc %[[VAL_25]] : (() -> ()) -> !fir.boxproc<() -> ()>
31 ! CHECK: fir.box_addr %[[VAL_26]] : (!fir.boxproc<() -> ()>) -> (() -> ())