[flang-commits] [flang] [Flang][MIF] Adding support of intrinsics with coarray argument (PR #192944)

Dan Bonachea via flang-commits flang-commits at lists.llvm.org
Thu Apr 23 20:46:02 PDT 2026


================
@@ -0,0 +1,21 @@
+! RUN: %flang_fc1 -emit-hlfir -fcoarray %s -o - | FileCheck %s
+
+program test
+  integer :: res1(3), res2
+  integer, allocatable :: a[:,:,:]
+
+  allocate(a[2,3:5,*])
+
+  ! CHECK: mif.lcobound coarray %[[COARRAY:.*]] : (!fir.heap<i32>) -> !fir.box<!fir.array<?xi64>>
+  res1 = lcobound(a)
+
+  ! CHECK: mif.lcobound coarray %[[COARRAY:.*]] dim %[[C2:.*]] : (!fir.heap<i32>, i32) -> i32
+  res2 = lcobound(a, DIM=2)
+
+  ! CHECK: mif.ucobound coarray %[[COARRAY:.*]] : (!fir.heap<i32>) -> !fir.box<!fir.array<?xi64>>
+  res1 = ucobound(a)
+
+  ! CHECK: mif.ucobound coarray %[[COARRAY:.*]] dim %[[C2:.*]] : (!fir.heap<i32>, i32) -> i32
+  res2 = ucobound(a, DIM=2)
+
----------------
bonachea wrote:

Suggest also adding some coverage for the `KIND` parameter to `ucobound` and `lcobound`

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


More information about the flang-commits mailing list