1 ! RUN: bbc %s -o "-" -emit-fir -hlfir=false | FileCheck %s
3 integer(1) function fct1()
5 ! CHECK-LABEL: func @_QPfct1() -> i8
6 ! CHECK: return %{{.*}} : i8
8 integer(2) function fct2()
10 ! CHECK-LABEL: func @_QPfct2() -> i16
11 ! CHECK: return %{{.*}} : i16
13 integer(4) function fct3()
15 ! CHECK-LABEL: func @_QPfct3() -> i32
16 ! CHECK: return %{{.*}} : i32
18 integer(8) function fct4()
20 ! CHECK-LABEL: func @_QPfct4() -> i64
21 ! CHECK: return %{{.*}} : i64
23 integer(16) function fct5()
25 ! CHECK-LABEL: func @_QPfct5() -> i128
26 ! CHECK: return %{{.*}} : i128
31 ! CHECK-LABEL: func @_QPfct() -> i32
32 ! CHECK: return %{{.*}} : i32
34 function fct_res() result(res
)
37 ! CHECK-LABEL: func @_QPfct_res() -> i32
38 ! CHECK: return %{{.*}} : i32
40 integer function fct_body()
45 ! CHECK-LABEL: func @_QPfct_body() -> i32
48 ! CHECK: %{{.*}} = fir.call @_FortranAStopStatement
49 ! CHECK: fir.unreachable
52 integer, dimension(10) :: fct_iarr1
55 ! CHECK-LABEL: func @_QPfct_iarr1() -> !fir.array<10xi32>
56 ! CHECK: return %{{.*}} : !fir.array<10xi32>
59 integer, dimension(10, 20) :: fct_iarr2
62 ! CHECK-LABEL: func @_QPfct_iarr2() -> !fir.array<10x20xi32>
63 ! CHECK: return %{{.*}} : !fir.array<10x20xi32>
65 logical(1) function lfct1()
67 ! CHECK-LABEL: func @_QPlfct1() -> !fir.logical<1>
68 ! CHECK: return %{{.*}} : !fir.logical<1>
70 logical(2) function lfct2()
72 ! CHECK-LABEL: func @_QPlfct2() -> !fir.logical<2>
73 ! CHECK: return %{{.*}} : !fir.logical<2>
75 logical(4) function lfct3()
77 ! CHECK-LABEL: func @_QPlfct3() -> !fir.logical<4>
78 ! CHECK: return %{{.*}} : !fir.logical<4>
80 logical(8) function lfct4()
82 ! CHECK-LABEL: func @_QPlfct4() -> !fir.logical<8>
83 ! CHECK: return %{{.*}} : !fir.logical<8>
85 real(2) function rfct1()
87 ! CHECK-LABEL: func @_QPrfct1() -> f16
88 ! CHECK: return %{{.*}} : f16
90 real(3) function rfct2()
92 ! CHECK-LABEL: func @_QPrfct2() -> bf16
93 ! CHECK: return %{{.*}} : bf16
97 ! CHECK-LABEL: func @_QPrfct3() -> f32
98 ! CHECK: return %{{.*}} : f32
100 real(8) function rfct4()
102 ! CHECK-LABEL: func @_QPrfct4() -> f64
103 ! CHECK: return %{{.*}} : f64
105 real(10) function rfct5()
107 ! CHECK-LABEL: func @_QPrfct5() -> f80
108 ! CHECK: return %{{.*}} : f80
110 real(16) function rfct6()
112 ! CHECK-LABEL: func @_QPrfct6() -> f128
113 ! CHECK: return %{{.*}} : f128
115 complex(2) function cplxfct1()
117 ! CHECK-LABEL: func @_QPcplxfct1() -> complex<f16>
118 ! CHECK: return %{{.*}} : complex<f16>
120 complex(3) function cplxfct2()
122 ! CHECK-LABEL: func @_QPcplxfct2() -> complex<bf16>
123 ! CHECK: return %{{.*}} : complex<bf16>
125 complex(4) function cplxfct3()
127 ! CHECK-LABEL: func @_QPcplxfct3() -> complex<f32>
128 ! CHECK: return %{{.*}} : complex<f32>
130 complex(8) function cplxfct4()
132 ! CHECK-LABEL: func @_QPcplxfct4() -> complex<f64>
133 ! CHECK: return %{{.*}} : complex<f64>
135 complex(10) function cplxfct5()
137 ! CHECK-LABEL: func @_QPcplxfct5() -> complex<f80>
138 ! CHECK: return %{{.*}} : complex<f80>
140 complex(16) function cplxfct6()
142 ! CHECK-LABEL: func @_QPcplxfct6() -> complex<f128>
143 ! CHECK: return %{{.*}} : complex<f128>
145 function fct_with_character_return(i
)
146 character(10) :: fct_with_character_return
149 ! CHECK-LABEL: func @_QPfct_with_character_return(
150 ! CHECK-SAME: %{{.*}}: !fir.ref<!fir.char<1,10>>{{.*}}, %{{.*}}: index{{.*}}, %{{.*}}: !fir.ref<i32>{{.*}}) -> !fir.boxchar<1> {