[flang-commits] [flang] [flang][OpenMP] Add semantics test: named COMMON + member with firstprivate+lastprivate is valid (PR #162234)
Krish Gupta via flang-commits
flang-commits at lists.llvm.org
Tue Oct 7 00:27:59 PDT 2025
https://github.com/KrxGu created https://github.com/llvm/llvm-project/pull/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 #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" />
>From a6d387e265f497f680634f99b365bee9cf9ff33f Mon Sep 17 00:00:00 2001
From: Krish Gupta <krishgupta at Krishs-MacBook-Air.local>
Date: Tue, 7 Oct 2025 12:55:14 +0530
Subject: [PATCH] [flang][OpenMP] Add test: named COMMON + member with
firstprivate+lastprivate is valid
---
flang/test/Semantics/OpenMP/omp-common-fp-lp.f90 | 13 +++++++++++++
1 file changed, 13 insertions(+)
create mode 100644 flang/test/Semantics/OpenMP/omp-common-fp-lp.f90
diff --git a/flang/test/Semantics/OpenMP/omp-common-fp-lp.f90 b/flang/test/Semantics/OpenMP/omp-common-fp-lp.f90
new file mode 100644
index 0000000000000..3d6ba1547a09e
--- /dev/null
+++ b/flang/test/Semantics/OpenMP/omp-common-fp-lp.f90
@@ -0,0 +1,13 @@
+! RUN: %flang_fc1 -fopenmp -fsyntax-only %s 2>&1 | FileCheck %s --allow-empty
+! CHECK-NOT: error:
+! CHECK-NOT: warning:
+
+subroutine sub1()
+ common /com/ j
+ j = 10
+!$omp parallel do firstprivate(j) lastprivate(/com/)
+ do i = 1, 10
+ j = j + 1
+ end do
+!$omp end parallel do
+end
More information about the flang-commits
mailing list