[flang-commits] [flang] [flang][OpenMP] Don't crash on iterator modifier in declare mapper (PR #144359)
via flang-commits
flang-commits at lists.llvm.org
Mon Jun 16 07:09:31 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-semantics
Author: Krzysztof Parzyszek (kparzysz)
<details>
<summary>Changes</summary>
Both the declare mapper directive argument, and the iterator modifier can contain declaration-type-spec, so make sure that the processing of one ends before processing of the other begins in semantic analysis.
---
Full diff: https://github.com/llvm/llvm-project/pull/144359.diff
2 Files Affected:
- (modified) flang/lib/Semantics/resolve-names.cpp (+1-1)
- (added) flang/test/Lower/OpenMP/Todo/declare-mapper-iterator.f90 (+11)
``````````diff
diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp
index e23e91b674a73..0de642b2bd8df 100644
--- a/flang/lib/Semantics/resolve-names.cpp
+++ b/flang/lib/Semantics/resolve-names.cpp
@@ -1801,9 +1801,9 @@ void OmpVisitor::ProcessMapperSpecifier(const parser::OmpMapperSpecifier &spec,
Walk(std::get<parser::TypeSpec>(spec.t));
auto &varName{std::get<parser::Name>(spec.t)};
DeclareObjectEntity(varName);
+ EndDeclTypeSpec();
Walk(clauses);
- EndDeclTypeSpec();
PopScope();
}
diff --git a/flang/test/Lower/OpenMP/Todo/declare-mapper-iterator.f90 b/flang/test/Lower/OpenMP/Todo/declare-mapper-iterator.f90
new file mode 100644
index 0000000000000..dacd6d6246595
--- /dev/null
+++ b/flang/test/Lower/OpenMP/Todo/declare-mapper-iterator.f90
@@ -0,0 +1,11 @@
+!RUN: %not_todo_cmd %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=52 -o - %s 2>&1 | FileCheck %s
+
+!CHECK: Support for iterator modifiers is not implemented yet
+subroutine f(arg)
+ type :: s
+ integer :: a(10)
+ end type
+ type(s) :: arg(:)
+
+ !$omp declare mapper(m: s :: v) map(mapper(m), iterator(i = 1:10): v%a(i))
+end
``````````
</details>
https://github.com/llvm/llvm-project/pull/144359
More information about the flang-commits
mailing list