[flang-commits] [flang] [flang] materialize fir.box when it is from a block argument (PR #184898)

Scott Manley via flang-commits flang-commits at lists.llvm.org
Fri Mar 6 09:35:27 PST 2026


================
@@ -26,3 +26,29 @@ func.func @block_arg_memref(%arg0: !fir.ref<!fir.array<32xi32>>) {
 // CHECK:       memref.store {{%.+}}, [[BASE]][[[IDX]]] : memref<32xi32>
 // CHECK-NOT:   fir.array_coor
 
+// Verify fir.array_coor lowering when the base is a boxed block
+// argument. The pass must materialize fir.box_addr
+// first and must not emit an illegal direct box->memref fir.convert.
+func.func @block_arg_boxed_array(%arg0: !fir.box<!fir.array<?xi32>>) {
+  %c1 = arith.constant 1 : index
+  %c0 = arith.constant 0 : index
+  %c10 = arith.constant 10 : index
+  %loop_res = scf.for %i = %c0 to %c10 step %c1 iter_args(%arg1 = %arg0) -> (!fir.box<!fir.array<?xi32>>) {
----------------
rscottmanley wrote:

probably dont need the loop

https://github.com/llvm/llvm-project/pull/184898


More information about the flang-commits mailing list