[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Lower / ext-proc-as-actual-argument-1.f90
blobdca6f4d196344752c2c75fcd129495c68fc1dea6
1 ! RUN: bbc -emit-fir %s -o - | FileCheck %s
3 ! Test external procedure as actual argument with the implicit character type.
5 ! CHECK-LABEL: func @_QQmain
6 ! CHECK: %[[VAL_0:.*]] = fir.address_of(@_QPext_func) : (!fir.ref<!fir.char<1,?>>, index) -> !fir.boxchar<1>
7 ! CHECK: %[[VAL_1:.*]] = fir.emboxproc %[[VAL_0]] : ((!fir.ref<!fir.char<1,?>>, index) -> !fir.boxchar<1>) -> !fir.boxproc<() -> ()>
8 ! CHECK: %[[VAL_2:.*]] = fir.undefined i64
9 ! CHECK: %[[VAL_3:.*]] = fir.undefined tuple<!fir.boxproc<() -> ()>, i64>
10 ! CHECK: %[[VAL_4:.*]] = fir.insert_value %[[VAL_3]], %[[VAL_1]], [0 : index] : (tuple<!fir.boxproc<() -> ()>, i64>, !fir.boxproc<() -> ()>) -> tuple<!fir.boxproc<() -> ()>, i64>
11 ! CHECK: %[[VAL_5:.*]] = fir.insert_value %[[VAL_4]], %[[VAL_2]], [1 : index] : (tuple<!fir.boxproc<() -> ()>, i64>, i64) -> tuple<!fir.boxproc<() -> ()>, i64>
12 ! CHECK: fir.call @_QFPsub(%[[VAL_5]]) {{.*}}: (tuple<!fir.boxproc<() -> ()>, i64>) -> ()
13 ! CHECK: return
15 ! CHECK-LABEL: func @_QPext_func(
16 ! CHECK: %[[ARG_0:.*]]: !fir.ref<!fir.char<1,?>>, %[[ARG_1:.*]]: index) -> !fir.boxchar<1> {
17 program m
18 external :: ext_func
19 call sub(ext_func)
21 contains
22 subroutine sub(arg)
23 character(20), external :: arg
24 print *, arg()
25 end
26 end
28 function ext_func() result(res)
29 character(*) res
30 res = "hello world"
31 end