[flang-commits] [flang] cb017fd - [flang][OpenACC] Fix false DEFAULT(NONE) error for named DO loop construct names (#189204)

via flang-commits flang-commits at lists.llvm.org
Sun Mar 29 12:49:50 PDT 2026


Author: Eugene Epshteyn
Date: 2026-03-29T15:49:44-04:00
New Revision: cb017fd1b4fb0b6b93f6b1cff3c7f36d80b33c48

URL: https://github.com/llvm/llvm-project/commit/cb017fd1b4fb0b6b93f6b1cff3c7f36d80b33c48
DIFF: https://github.com/llvm/llvm-project/commit/cb017fd1b4fb0b6b93f6b1cff3c7f36d80b33c48.diff

LOG: [flang][OpenACC] Fix false DEFAULT(NONE) error for named DO loop construct names (#189204)

In OpenACC semantic checking filter out symbols with MiscDetails, which
include construct names, scope names, complex part designators, type
parameter inquiries, etc.

Added: 
    

Modified: 
    flang/lib/Semantics/resolve-directives.cpp
    flang/test/Semantics/OpenACC/acc-parallel.f90

Removed: 
    


################################################################################
diff  --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp
index d5cfcabc319ab..fb241d2606b47 100644
--- a/flang/lib/Semantics/resolve-directives.cpp
+++ b/flang/lib/Semantics/resolve-directives.cpp
@@ -1833,7 +1833,7 @@ void AccAttributeVisitor::Post(const parser::Name &name) {
     const Symbol &symbol{name.symbol->GetUltimate()};
     if (!symbol.owner().IsDerivedType() && !symbol.has<ProcEntityDetails>() &&
         !symbol.has<SubprogramDetails>() && !IsObjectWithVisibleDSA(symbol) &&
-        !symbol.has<AssocEntityDetails>()) {
+        !symbol.has<AssocEntityDetails>() && !symbol.has<MiscDetails>()) {
       if (Symbol * found{currScope().FindSymbol(name.source)}) {
         if (&symbol != found) {
           // adjust the symbol within the region

diff  --git a/flang/test/Semantics/OpenACC/acc-parallel.f90 b/flang/test/Semantics/OpenACC/acc-parallel.f90
index b3120e63ff6a1..a5a8890b63ff4 100644
--- a/flang/test/Semantics/OpenACC/acc-parallel.f90
+++ b/flang/test/Semantics/OpenACC/acc-parallel.f90
@@ -221,4 +221,11 @@ subroutine acc_parallel_default_none
   end do
   !$acc end parallel
   !$acc end data
+
+  ! Named DO loop construct name should not be flagged by default(none).
+  !$acc parallel loop firstprivate(l) copyin(a) default(none)
+  outer: do i = 1, l
+    a(1,i) = 1
+  end do outer
+  !$acc end parallel
 end subroutine acc_parallel_default_none


        


More information about the flang-commits mailing list