[all-commits] [llvm/llvm-project] 621379: [flang][OpenMP] Check DEFAULT(NONE) on metadirecti...
Chi-Chun, Chen via All-commits
all-commits at lists.llvm.org
Thu Jul 16 13:33:12 PDT 2026
Branch: refs/heads/users/cchen/flang-metadirective-loop-default-none
Home: https://github.com/llvm/llvm-project
Commit: 6213796abdf80614731823742190fd4244cb16b2
https://github.com/llvm/llvm-project/commit/6213796abdf80614731823742190fd4244cb16b2
Author: chichunchen <chichunchen844 at gmail.com>
Date: 2026-07-16 (Thu, 16 Jul 2026)
Changed paths:
M flang/lib/Semantics/check-omp-structure.h
M flang/lib/Semantics/check-omp-variant.cpp
A flang/test/Semantics/OpenMP/metadirective-default-none.f90
Log Message:
-----------
[flang][OpenMP] Check DEFAULT(NONE) on metadirective loop variants
A standalone metadirective and its associated loop are separate nodes in the
parse tree. For example:
```fortran
!$omp metadirective &
!$omp& when(implementation={vendor(llvm)}: &
!$omp& parallel do default(none) shared(n, a)) default(nothing)
do i = 1, n
a(i) = x
end do
```
An ordinary PARALLEL DO contains its loop in the parse tree:
```
PARALLEL DO
|-- DEFAULT(NONE)
|-- SHARED(n, a)
`-- DO
`-- a(i) = x
```
Name resolution therefore visits the loop body while the PARALLEL DO
context is active and diagnoses that x has no data-sharing attribute.
For a standalone metadirective, the tree instead looks like:
```
METADIRECTIVE
`-- WHEN
`-- PARALLEL DO specification
|-- DEFAULT(NONE)
`-- SHARED(n, a)
DO
`-- a(i) = x
```
Name resolution leaves the variant context before visiting the separate
DO construct, so the variant's DEFAULT(NONE) clause was not applied to
the loop body.
After associating a metadirective with its loop, check each potentially
selectable loop variant for variables that require an explicit
data-sharing attribute. Keep the analysis independent for each variant
and avoid modifying symbol DSA state.
Preserve the existing rules for predetermined data-sharing attributes,
nested constructs, and statically inapplicable variants.
Add semantic tests covering explicit and missing DSAs, variant
isolation, static applicability, dynamic conditions, local variables,
host association, and nested tasks.
Assisted with codex.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list