[flang-commits] [flang] 8d386c6 - [Frontend][OpenMP] Reduction modifier must be applied somewhere (#92160)
via flang-commits
flang-commits at lists.llvm.org
Wed May 15 07:05:07 PDT 2024
Author: Krzysztof Parzyszek
Date: 2024-05-15T09:05:02-05:00
New Revision: 8d386c63a8d38bc50acba8dba2cd5f0daca57012
URL: https://github.com/llvm/llvm-project/commit/8d386c63a8d38bc50acba8dba2cd5f0daca57012
DIFF: https://github.com/llvm/llvm-project/commit/8d386c63a8d38bc50acba8dba2cd5f0daca57012.diff
LOG: [Frontend][OpenMP] Reduction modifier must be applied somewhere (#92160)
Detect the case when a reduction modifier ends up not being applied
after construct decomposition, treat it as an error.
This fixes a regression in the gfortran test suite after PR90098.
Added:
flang/test/Lower/OpenMP/invalid-reduction-modifier.f90
Modified:
llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
Removed:
################################################################################
diff --git a/flang/test/Lower/OpenMP/invalid-reduction-modifier.f90 b/flang/test/Lower/OpenMP/invalid-reduction-modifier.f90
new file mode 100644
index 0000000000000..817c5b731c62f
--- /dev/null
+++ b/flang/test/Lower/OpenMP/invalid-reduction-modifier.f90
@@ -0,0 +1,14 @@
+!Remove the --crash below once we can diagnose the issue more gracefully.
+!RUN: not --crash %flang_fc1 -fopenmp -emit-hlfir -o - %s
+
+! Check that we reject the "task" reduction modifier on the "simd" directive.
+
+subroutine fred(x)
+ integer, intent(inout) :: x
+
+ !$omp simd reduction(task, +:x)
+ do i = 1, 100
+ x = foo(i)
+ enddo
+ !$omp end simd
+end
diff --git a/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h b/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
index 02c88a58e0993..3fa27608ead94 100644
--- a/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
+++ b/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
@@ -935,7 +935,8 @@ bool ConstructDecompositionT<C, H>::applyClause(
// Apply clause without modifier.
leaf.clauses.push_back(unmodified);
}
- applied = true;
+ // The modifier must be applied to some construct.
+ applied = effectiveApplied;
}
if (!applied)
More information about the flang-commits
mailing list