[flang-commits] [flang] [flang][OpenACC] Relax COMMON block usage restriction in OpenACC directives (PR #162659)
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Thu Oct 9 14:25:34 PDT 2025
================
@@ -1695,17 +1695,23 @@ void AccAttributeVisitor::Post(const parser::Name &name) {
Symbol *AccAttributeVisitor::ResolveAccCommonBlockName(
const parser::Name *name) {
- if (auto *prev{name
- ? GetContext().scope.parent().FindCommonBlock(name->source)
- : nullptr}) {
- name->symbol = prev;
- return prev;
- }
- // Check if the Common Block is declared in the current scope
- if (auto *commonBlockSymbol{
- name ? GetContext().scope.FindCommonBlock(name->source) : nullptr}) {
- name->symbol = commonBlockSymbol;
- return commonBlockSymbol;
+ if (!name) {
+ return nullptr;
+ }
+ // Check the local and surrounding scopes first
+ if (auto *cb{GetProgramUnitOrBlockConstructContaining(GetContext().scope)
+ .FindCommonBlock(name->source)}) {
+ name->symbol = cb;
+ return cb;
+ }
+ // Look for COMMON block in the modules
----------------
klausler wrote:
Are you sure that this part makes sense? Do you have an example where NVF looks at non-USE-associated modules? You probably just want to look for a USE-associated common block in the enclosing scopes instead.
https://github.com/llvm/llvm-project/pull/162659
More information about the flang-commits
mailing list