@@ -133,9 +133,20 @@ subroutine int_allocatable_to_assumed_rank_opt(x)
133
133
! CHECK: %[[VAL_11:.*]] = fir.convert %[[VAL_7]] : (!fir.box<!fir.array<?x?xi32>>) -> !fir.box<!fir.array<*:i32>>
134
134
! CHECK: fir.call @_QPint_opt_assumed_rank(%[[VAL_11]]) fastmath<contract> : (!fir.box<!fir.array<*:i32>>) -> ()
135
135
136
- ! TODO: set assumed size last extent to -1.
137
- ! subroutine int_r2_assumed_size_to_assumed_rank(x)
138
- ! use ifaces, only : int_assumed_rank
139
- ! integer :: x(10, *)
140
- ! call int_assumed_rank(x)
141
- ! end subroutine
136
+ subroutine int_r2_assumed_size_to_assumed_rank (x )
137
+ use ifaces, only : int_assumed_rank
138
+ integer :: x(10 , * )
139
+ call int_assumed_rank(x)
140
+ end subroutine
141
+ ! CHECK-LABEL: func.func @_QPint_r2_assumed_size_to_assumed_rank(
142
+ ! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<!fir.array<10x?xi32>> {fir.bindc_name = "x"}) {
143
+ ! CHECK: %[[VAL_1:.*]] = arith.constant 10 : i64
144
+ ! CHECK: %[[VAL_2:.*]] = fir.convert %[[VAL_1]] : (i64) -> index
145
+ ! CHECK: %[[VAL_3:.*]] = arith.constant 0 : index
146
+ ! CHECK: %[[VAL_4:.*]] = arith.cmpi sgt, %[[VAL_2]], %[[VAL_3]] : index
147
+ ! CHECK: %[[VAL_5:.*]] = arith.select %[[VAL_4]], %[[VAL_2]], %[[VAL_3]] : index
148
+ ! CHECK: %[[VAL_6:.*]] = arith.constant -1 : index
149
+ ! CHECK: %[[VAL_7:.*]] = fir.shape %[[VAL_5]], %[[VAL_6]] : (index, index) -> !fir.shape<2>
150
+ ! CHECK: %[[VAL_8:.*]]:2 = hlfir.declare %[[VAL_0]](%[[VAL_7]]) {uniq_name = "_QFint_r2_assumed_size_to_assumed_rankEx"} : (!fir.ref<!fir.array<10x?xi32>>, !fir.shape<2>) -> (!fir.box<!fir.array<10x?xi32>>, !fir.ref<!fir.array<10x?xi32>>)
151
+ ! CHECK: %[[VAL_9:.*]] = fir.convert %[[VAL_8]]#0 : (!fir.box<!fir.array<10x?xi32>>) -> !fir.box<!fir.array<*:i32>>
152
+ ! CHECK: fir.call @_QPint_assumed_rank(%[[VAL_9]]) fastmath<contract> : (!fir.box<!fir.array<*:i32>>) -> ()
0 commit comments