[flang-commits] [flang] [flang][acc] Fix crash on collapse(force:N) with non-tightly nested loops (PR #191310)
Razvan Lupusoru via flang-commits
flang-commits at lists.llvm.org
Thu Apr 16 11:40:03 PDT 2026
================
@@ -0,0 +1,28 @@
+! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s
+
+! Verify that collapse(force:N) on non-tightly nested loops (with code
+! between loops) does not crash the compiler.
+
+subroutine collapse_force_non_tight(a, n)
+ implicit none
+ integer, intent(in) :: n
+ real, intent(inout) :: a(n, n, n)
+ integer :: i, j, k
+ real :: tmp
+
+ !$acc parallel loop collapse(force:3) copy(a)
+ do i = 1, n
+ do j = 1, n
+ tmp = real(i + j)
+ do k = 1, n
+ a(i, j, k) = tmp + real(k)
+ end do
+ end do
+ end do
+ !$acc end parallel loop
+end subroutine
+
+! CHECK: func.func @_QPcollapse_force_non_tight
+! CHECK: acc.parallel
+! CHECK: acc.loop
----------------
razvanlupusoru wrote:
Can you also test that the statements are inside the loop as you expected?
https://github.com/llvm/llvm-project/pull/191310
More information about the flang-commits
mailing list