[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
Fri Apr 17 09:48:56 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
----------------
razvanlupusoru wrote:
Here is the example I would like to see being tested:
```
!$acc parallel loop collapse(force:3) copy(a)
do i = 1, n
do j = 1, n
tmp = real(i + j)
!$acc loop
do k = 1, n
a(i, j, k) = tmp + real(k)
end do
end do
end do
!$acc end parallel loop
```
https://github.com/llvm/llvm-project/pull/191310
More information about the flang-commits
mailing list