[flang-commits] [flang] [flang][OpenMP] Detect DSA conflicts in nested loop constructs (PR #195323)
Leandro Lupori via flang-commits
flang-commits at lists.llvm.org
Mon May 4 06:48:53 PDT 2026
================
@@ -498,15 +502,19 @@ void OmpStructureChecker::CheckIterationVariables(
"The DO loop iteration variable must be of integer type"_err_en_US,
iv.ToString());
}
- const Symbol *host{GetHostSymbol(*iv.symbol)};
- if (!host) {
- continue;
- }
- if (host->test(Symbol::Flag::OmpThreadprivate)) {
+ if (iv.symbol->GetUltimate().test(Symbol::Flag::OmpThreadprivate)) {
context_.Say(iv.source,
"Loop iteration variable of an affected loop cannot be THREADPRIVATE"_err_en_US,
iv.ToString());
}
+ // Get the symbol from the variable that was listed in a DSA clause.
+ const Symbol *host{iv.symbol};
+ while (host && !dsa.count(host)) {
+ host = GetHostSymbol(*host);
+ }
----------------
luporl wrote:
In the PR's example, why was a single `GetHostSymbol()` not enough to detect `k`'s DSA in the nested loop?
Was it returning a symbol with no DSA in DO's scope, representing a use from the symbol in the enclosing PARALLEL scope?
https://github.com/llvm/llvm-project/pull/195323
More information about the flang-commits
mailing list