[all-commits] [llvm/llvm-project] 3b80cd: [flang][OpenMP] Check DEFAULT(NONE) on metadirecti...
Chi-Chun, Chen via All-commits
all-commits at lists.llvm.org
Mon Jul 20 11:06:40 PDT 2026
Branch: refs/heads/users/cchen/flang-metadirective-loop-default-none
Home: https://github.com/llvm/llvm-project
Commit: 3b80cd45daebaa1a898aed97356f8810e954c52f
https://github.com/llvm/llvm-project/commit/3b80cd45daebaa1a898aed97356f8810e954c52f
Author: chichunchen <chichunchen844 at gmail.com>
Date: 2026-07-20 (Mon, 20 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
Flang does not enforce `DEFAULT(NONE)` for variables referenced in a loop
associated with a standalone METADIRECTIVE. Consequently, it accepts invalid
programs when a potentially selectable loop variant specifies DEFAULT(NONE) but
omits a referenced variable from its data-sharing clauses. This change checks the
associated loop for each potentially selectable `DEFAULT(NONE)` variant and
diagnoses missing data-sharing attributes as it does for ordinary OpenMP loop
constructs.
Standalone metadirectives and their associated loops are separate parse-tree
nodes. 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
```
Unlike an ordinary `PARALLEL DO`, the loop is not nested under the directive:
```text
METADIRECTIVE
`-- WHEN
`-- PARALLEL DO DEFAULT(NONE) SHARED(n, a)
DO
`-- a(i) = x
```
Name resolution therefore leaves the variant context before visiting the loop and
does not diagnose the missing data-sharing attribute for `x`.
After associating a metadirective with its loop, validate DEFAULT(NONE) for each
potentially selectable loop variant. Preserve the existing rules for
predetermined and explicit data-sharing attributes, static locals, nested
constructs, specification expressions, and statically inapplicable variants.
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