[flang-commits] [flang] [flang][OpenMP] Catch threadprivate common block vars that appear in equivalence (PR #127642)
Kiran Chandramohan via flang-commits
flang-commits at lists.llvm.org
Tue Feb 18 13:04:25 PST 2025
================
@@ -1479,7 +1479,22 @@ void OmpStructureChecker::CheckThreadprivateOrDeclareTargetVar(
}
}
},
- [&](const parser::Name &) {}, // common block
+ [&](const parser::Name &name) {
+ if (!name.symbol) {
+ return;
+ }
+ if (auto *cb{name.symbol->detailsIf<CommonBlockDetails>()}) {
+ for (const auto &obj : cb->objects()) {
+ if (FindEquivalenceSet(*obj)) {
+ context_.Say(name.source,
+ "A variable in a %s directive cannot appear in an EQUIVALENCE statement"
+ " (variable '%s' from common block '/%s/')"_err_en_US,
+ ContextDirectiveAsFortran(), obj->name(),
+ name.symbol->name());
+ }
+ }
+ }
----------------
kiranchandramohan wrote:
Nit: The frontend style is to nest
```
if (name.symbol) {
if (auto *cb{name.symbol->detailsIf<CommonBlockDetails>()}) {
....
}
}
```
https://github.com/llvm/llvm-project/pull/127642
More information about the flang-commits
mailing list