Skip to content

Commit 1c8e0b9

Browse files
Add omp_orig
1 parent 05c5f83 commit 1c8e0b9

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

flang/lib/Semantics/resolve-names.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1761,9 +1761,9 @@ void OmpVisitor::ProcessReductionSpecifier(
17611761

17621762
auto &typeList{std::get<parser::OmpTypeNameList>(spec.t)};
17631763

1764-
// Create a temporary variable declaration for the three variables
1765-
// used in the reduction specifier (omp_out, omp_in and omp_priv),
1766-
// with of the type in the typeList.
1764+
// Create a temporary variable declaration for the four variables
1765+
// used in the reduction specifier and initializer (omp_out, omp_in,
1766+
// omp_priv and omp_orig), with the type in the typeList.
17671767
//
17681768
// In theory it would be possible to create only variables that are
17691769
// actually used, but that requires walking the entire parse-tree of the
@@ -1777,7 +1777,7 @@ void OmpVisitor::ProcessReductionSpecifier(
17771777
// as variables in the outer scope, if there's more than one type in the
17781778
// typelist, duplicate symbols will be reported.
17791779
const parser::CharBlock ompVarNames[]{
1780-
{"omp_in", 6}, {"omp_out", 7}, {"omp_priv", 8}};
1780+
{"omp_in", 6}, {"omp_out", 7}, {"omp_priv", 8}, {"omp_orig", 8} };
17811781

17821782
for (auto &t : typeList.v) {
17831783
PushScope(Scope::Kind::OtherConstruct, nullptr);

flang/test/Semantics/OpenMP/declare-reduction.f90

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ end subroutine initme
2020
!CHECK: red_add: Misc ConstructName
2121
!CHECK: Subprogram scope: initme
2222
!CHECK: omp_in size=4 offset=0: ObjectEntity type: INTEGER(4)
23-
!CHECK: omp_out size=4 offset=4: ObjectEntity type: INTEGER(4)
24-
!CHECK: omp_priv size=4 offset=8: ObjectEntity type: INTEGER(4)
23+
!CHECK: omp_orig size=4 offset=4: ObjectEntity type: INTEGER(4)
24+
!CHECK: omp_out size=4 offset=8: ObjectEntity type: INTEGER(4)
25+
!CHECK: omp_priv size=4 offset=12: ObjectEntity type: INTEGER(4)
2526
!$omp simd reduction(red_add:res)
2627
do i=1,n
2728
res=res+x(i)
@@ -36,7 +37,8 @@ program main
3637

3738
!CHECK: my_add_red: Misc ConstructName
3839
!CHECK: omp_in size=4 offset=0: ObjectEntity type: INTEGER(4)
39-
!CHECK: omp_out size=4 offset=4: ObjectEntity type: INTEGER(4)
40-
!CHECK: omp_priv size=4 offset=8: ObjectEntity type: INTEGER(4)
40+
!CHECK: omp_orig size=4 offset=4: ObjectEntity type: INTEGER(4)
41+
!CHECK: omp_out size=4 offset=8: ObjectEntity type: INTEGER(4)
42+
!CHECK: omp_priv size=4 offset=12: ObjectEntity type: INTEGER(4)
4143

4244
end program main

0 commit comments

Comments
 (0)