Skip to content

Commit 346c4c0

Browse files
Krish GuptaKrish Gupta
authored andcommitted
[flang][OpenMP] Add test: named COMMON + member with firstprivate+lastprivate is valid
Gate test to OpenMP 5.1+ and add explanatory comment per review feedback.
1 parent 6b1604a commit 346c4c0

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
! RUN: %flang_fc1 -fopenmp -fopenmp-version=51 -Wno-experimental-option -fsyntax-only %s 2>&1 | FileCheck %s --allow-empty
2+
! CHECK-NOT: error:
3+
! CHECK-NOT: warning:
4+
5+
! Regression test for issue #162033.
6+
! Verify that a named COMMON block can appear in a data-sharing clause together
7+
! with one of its members in another clause on the same construct. This is valid
8+
! in OpenMP >= 5.1 because:
9+
! - A named COMMON in a clause is equivalent to listing all its explicit members
10+
! - A list item may appear in both FIRSTPRIVATE and LASTPRIVATE on the same directive
11+
! OpenMP 5.0 explicitly forbade this combination.
12+
13+
subroutine sub1()
14+
common /com/ j
15+
j = 10
16+
!$omp parallel do firstprivate(j) lastprivate(/com/)
17+
do i = 1, 10
18+
j = j + 1
19+
end do
20+
!$omp end parallel do
21+
end

0 commit comments

Comments
 (0)