1 ! Test lowering of nullify-statement
2 ! RUN: bbc -emit-fir %s -o - | FileCheck %s
5 ! -----------------------------------------------------------------------------
7 ! -----------------------------------------------------------------------------
10 ! CHECK-LABEL: func @_QPtest_scalar(
11 ! CHECK-SAME: %[[p:.*]]: !fir.ref<!fir.box<!fir.ptr<f32>>>{{.*}})
12 subroutine test_scalar(p
)
14 ! CHECK: %[[null:.*]] = fir.zero_bits !fir.ptr<f32>
15 ! CHECK: %[[box:.*]] = fir.embox %[[null]] : (!fir.ptr<f32>) -> !fir.box<!fir.ptr<f32>>
16 ! CHECK: fir.store %[[box]] to %[[p]] : !fir.ref<!fir.box<!fir.ptr<f32>>>
20 ! CHECK-LABEL: func @_QPtest_scalar_char(
21 ! CHECK-SAME: %[[p:.*]]: !fir.ref<!fir.box<!fir.ptr<!fir.char<1,?>>>>{{.*}})
22 subroutine test_scalar_char(p
)
23 character(:), pointer :: p
24 ! CHECK: %[[null:.*]] = fir.zero_bits !fir.ptr<!fir.char<1,?>>
25 ! CHECK: %[[box:.*]] = fir.embox %[[null]] typeparams %c0{{.*}} : (!fir.ptr<!fir.char<1,?>>, index) -> !fir.box<!fir.ptr<!fir.char<1,?>>>
26 ! CHECK: fir.store %[[box]] to %[[p]] : !fir.ref<!fir.box<!fir.ptr<!fir.char<1,?>>>>
30 ! CHECK-LABEL: func @_QPtest_array(
31 ! CHECK-SAME: %[[p:.*]]: !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>>{{.*}})
32 subroutine test_array(p
)
34 ! CHECK: %[[null:.*]] = fir.zero_bits !fir.ptr<!fir.array<?xf32>>
35 ! CHECK: %[[shape:.*]] = fir.shape %c0{{.*}}
36 ! CHECK: %[[box:.*]] = fir.embox %[[null]](%[[shape]]) : (!fir.ptr<!fir.array<?xf32>>, !fir.shape<1>) -> !fir.box<!fir.ptr<!fir.array<?xf32>>>
37 ! CHECK: fir.store %[[box]] to %[[p]] : !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>>
41 ! CHECK-LABEL: func @_QPtest_list(
42 ! CHECK-SAME: %[[p1:.*]]: !fir.ref<!fir.box<!fir.ptr<f32>>>{{.*}}, %[[p2:.*]]: !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>>{{.*}})
43 subroutine test_list(p1
, p2
)
44 real, pointer :: p1
, p2(:)
45 ! CHECK: fir.zero_bits !fir.ptr<f32>
46 ! CHECK: fir.store %{{.*}} to %[[p1]] : !fir.ref<!fir.box<!fir.ptr<f32>>>
48 ! CHECK: fir.zero_bits !fir.ptr<!fir.array<?xf32>>
49 ! CHECK: fir.store %{{.*}} to %[[p2]] : !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>>