[flang-commits] [flang] [flang][OpenMP] Update semantic checks for LINEAR clause (PR #177055)
Michael Kruse via flang-commits
flang-commits at lists.llvm.org
Thu Jan 22 05:41:17 PST 2026
================
@@ -759,54 +759,61 @@ void OmpStructureChecker::Enter(const parser::OmpClause::Linear &x) {
auto &modifiers{OmpGetModifiers(x.v)};
linearMod = OmpGetUniqueModifier<parser::OmpLinearModifier>(modifiers);
if (linearMod) {
- // 2.7 Loop Construct Restriction
- if ((llvm::omp::allDoSet | llvm::omp::allSimdSet).test(dir)) {
- context_.Say(clauseSource,
- "A modifier may not be specified in a LINEAR clause on the %s directive"_err_en_US,
- ContextDirectiveAsFortran());
- // Don't return early - continue to check other restrictions
- }
-
auto &desc{OmpGetDescriptor<parser::OmpLinearModifier>()};
- for (auto &[symbol, source] : symbols) {
- if (linearMod->v != parser::OmpLinearModifier::Value::Ref) {
- CheckIntegerNoRef(symbol, source);
- } else {
- if (!IsAllocatable(*symbol) && !IsAssumedShape(*symbol) &&
- !IsPolymorphic(*symbol)) {
- context_.Say(source,
- "The list item `%s` specified with the REF '%s' must be polymorphic variable, assumed-shape array, or a variable with the `ALLOCATABLE` attribute"_err_en_US,
- symbol->name(), desc.name.str());
- }
+ parser::CharBlock modSource{OmpGetModifierSource(modifiers, linearMod)};
+ bool valid{true};
+
+ if (version < 52) {
+ // Modifiers on LINEAR are only allowed on DECLARE SIMD
----------------
Meinersbur wrote:
The comment seems to belong to line 777 below. IIUC, this checks for syntax not yet evailable before OpenMP 5.2
https://github.com/llvm/llvm-project/pull/177055
More information about the flang-commits
mailing list