[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:41:18 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:
Can you also add test and ensure that if any inner loop has `!$acc loop` clause the collapsing still works?
https://github.com/llvm/llvm-project/pull/191310
More information about the flang-commits
mailing list