Skip to content

Commit ba25c19

Browse files
kparzyszfschlimb
authored andcommitted
[flang][OpenMP] Don't crash on iterator modifier in declare mapper (llvm#144359)
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 3195d5e commit ba25c19

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
@@ -1800,9 +1800,9 @@ void OmpVisitor::ProcessMapperSpecifier(const parser::OmpMapperSpecifier &spec,
18001800
Walk(std::get<parser::TypeSpec>(spec.t));
18011801
auto &varName{std::get<parser::Name>(spec.t)};
18021802
DeclareObjectEntity(varName);
1803+
EndDeclTypeSpec();
18031804

18041805
Walk(clauses);
1805-
EndDeclTypeSpec();
18061806
PopScope();
18071807
}
18081808

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)