Skip to content

Commit a5d8ab6

Browse files
committed
[flang][OpenMP] Don't crash on iterator modifier in declare mapper
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.
1 parent 01f9dff commit a5d8ab6

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

flang/lib/Semantics/resolve-names.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1801,9 +1801,9 @@ void OmpVisitor::ProcessMapperSpecifier(const parser::OmpMapperSpecifier &spec,
18011801
Walk(std::get<parser::TypeSpec>(spec.t));
18021802
auto &varName{std::get<parser::Name>(spec.t)};
18031803
DeclareObjectEntity(varName);
1804+
EndDeclTypeSpec();
18041805

18051806
Walk(clauses);
1806-
EndDeclTypeSpec();
18071807
PopScope();
18081808
}
18091809

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
!RUN: %not_todo_cmd %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=52 -o - %s 2>&1 | FileCheck %s
2+
3+
!CHECK: Support for iterator modifiers is not implemented yet
4+
subroutine f(arg)
5+
type :: s
6+
integer :: a(10)
7+
end type
8+
type(s) :: arg(:)
9+
10+
!$omp declare mapper(m: s :: v) map(mapper(m), iterator(i = 1:10): v%a(i))
11+
end

0 commit comments

Comments
 (0)