[flang-commits] [flang] [Flang][OpenMP] Fix crash when block.end() is missed (PR #147519)
David Spickett via flang-commits
flang-commits at lists.llvm.org
Tue Jul 8 07:09:27 PDT 2025
================
@@ -0,0 +1,75 @@
+! This reproducer hit an issue where when finding directive's, and end directive's would iterate over the block.end()
+! so Flang would crash. We should be able to parse this subroutine without flang crashing.
+! Reported in https://github.com/llvm/llvm-project/issues/147309 and https://github.com/llvm/llvm-project/pull/145917#issuecomment-3041570824
+
+!RUN: %flang_fc1 -fdebug-dump-parse-tree -fopenmp -fopenmp-version=51 %s | FileCheck %s --check-prefix=CHECK-PARSE
+!RUN: %flang_fc1 -fdebug-unparse -fopenmp -fopenmp-version=51 %s | FileCheck %s --check-prefix=CHECK-UNPARSE
+
+subroutine loop_transformation_construct7
+implicit none
+real(kind=8), dimension(1:10, 2) :: a
+integer :: b,c
+
+!$omp target teams distribute parallel do collapse(2) private(b)
+do b = 1, 10
+ do c = 1, 10
+ a(b, 2) = a(c, 1)
+ end do
+end do
+end subroutine
----------------
DavidSpickett wrote:
> There is then potential for the while loop to never be equal to block.end() as it advances the nextIt value before checking if it is block.end().
Ok this is the key part, I understand now, thanks.
https://github.com/llvm/llvm-project/pull/147519
More information about the flang-commits
mailing list