1 ! RUN: bbc -emit-fir %s -o - | FileCheck %s
3 ! CHECK-LABEL: allocated_test
4 ! CHECK-SAME: %[[arg0:.*]]: !fir.ref<!fir.box<!fir.heap<f32>>>{{.*}}, %[[arg1:.*]]: !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>{{.*}})
5 subroutine allocated_test(scalar
, array
)
6 real, allocatable
:: scalar
, array(:)
7 ! CHECK: %[[scalar:.*]] = fir.load %[[arg0]] : !fir.ref<!fir.box<!fir.heap<f32>>>
8 ! CHECK: %[[addr0:.*]] = fir.box_addr %[[scalar]] : (!fir.box<!fir.heap<f32>>) -> !fir.heap<f32>
9 ! CHECK: %[[addrToInt0:.*]] = fir.convert %[[addr0]]
10 ! CHECK: cmpi ne, %[[addrToInt0]], %c0{{.*}}
11 print *, allocated(scalar
)
12 ! CHECK: %[[array:.*]] = fir.load %[[arg1]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>
13 ! CHECK: %[[addr1:.*]] = fir.box_addr %[[array]] : (!fir.box<!fir.heap<!fir.array<?xf32>>>) -> !fir.heap<!fir.array<?xf32>>
14 ! CHECK: %[[addrToInt1:.*]] = fir.convert %[[addr1]]
15 ! CHECK: cmpi ne, %[[addrToInt1]], %c0{{.*}}
16 print *, allocated(array
)