Skip to content

Commit 581b654

Browse files
KrxGuKrish Gupta
andauthored
[flang][OpenMP] Add semantics test: named COMMON + member with firstprivate+lastprivate is valid (llvm#162234)
This adds a positive semantics test showing that: - A named COMMON block in a clause is equivalent to listing all explicit members. - The same list item may appear in both firstprivate and lastprivate on the same construct. The reporter example in llvm#162033 therefore conforms to OpenMP and Flang is correct to accept it. This test documents and locks in that behavior to avoid regressions. <img width="1606" height="350" alt="image" src="https://github.com/user-attachments/assets/0b464c58-b9cc-43e0-8d1f-1c5a5b993bf6" /> Co-authored-by: Krish Gupta <[email protected]>
1 parent 0935e15 commit 581b654

File tree

1 file changed

+20
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)