[flang-commits] [flang] [llvm] [Flang][OpenMP] Avoid aborting on nested derived types in DO CONCURRENT device conversion (PR #218963)

via flang-commits flang-commits at lists.llvm.org
Thu Sep 3 22:21:58 PDT 2026


================
@@ -0,0 +1,50 @@
+! Verifies that `do concurrent` correctly lowers map for basic nested derived
+! types, correctly mapping the required components of the derived type.
+! REQUIRES: flang, amdgpu
+
+! RUN: %libomptarget-compile-fortran-generic -fdo-concurrent-to-openmp=device
+! RUN: %libomptarget-run-generic 2>&1 | %fcheck-generic
+program main
+   implicit none
+
+   type :: alloc_buffer
+     integer :: i
+     real, allocatable :: data(:)
+   end type alloc_buffer
+
+   type :: buffer
+     integer :: i
+     real :: data(8)
+   end type buffer
+
+   type :: array_dt
+      type(buffer) :: buf
+   end type array_dt
+
+   type :: alloc_array_dt
+      type(alloc_buffer) :: buf
+   end type alloc_array_dt
+
+   integer, parameter :: n = 8
+   integer :: i
+   type(alloc_array_dt) :: aad
+   type(array_dt) :: ad
+
+   allocate(aad%buf%data(n), source=0.0)
+
+   do concurrent(i=1:n)
+      aad%buf%data(i) = real(i)
+   end do
+
+   do concurrent(i=1:n)
+      ad%buf%data(i) = real(i)
+   end do
+
+   print *, sum(ad%buf%data)
+   print *, sum(aad%buf%data)
+
+   deallocate(aad%buf%data)
+end program main
+
+! CHECK: 36.
----------------
MattPD wrote:

`CHECK: 36.` also matches `36.5`. The current FileCheck invocation passed when both output lines contained `36.5`. Could the program compare both sums exactly and print one `PASS` marker, or could these patterns be anchored to the end of the line?


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


More information about the flang-commits mailing list