[flang-commits] [flang] [flang] Avoid new spurious error under -fopenacc (PR #78504)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Wed Jan 17 13:27:47 PST 2024


https://github.com/klausler created https://github.com/llvm/llvm-project/pull/78504

Don't create HostAssocDetails symbols for subprograms in OpenACC regions; it can cause warnings to became errors later in compilation when calls do not appear to be to external procedures with implicit interfaces.

>From b618fa09a074d49dd54c838682a204be53432468 Mon Sep 17 00:00:00 2001
From: Peter Klausler <pklausler at nvidia.com>
Date: Wed, 17 Jan 2024 13:24:07 -0800
Subject: [PATCH] [flang] Avoid new spurious error under -fopenacc

Don't create HostAssocDetails symbols for subprograms in
OpenACC regions; it can cause warnings to became errors later
in compilation when calls do not appear to be to external
procedures with implicit interfaces.
---
 flang/lib/Semantics/resolve-directives.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp
index b30b81cf90c951..e31193f490f79a 100644
--- a/flang/lib/Semantics/resolve-directives.cpp
+++ b/flang/lib/Semantics/resolve-directives.cpp
@@ -1313,7 +1313,7 @@ void AccAttributeVisitor::Post(const parser::Name &name) {
   auto *symbol{name.symbol};
   if (symbol && !dirContext_.empty() && GetContext().withinConstruct) {
     if (!symbol->owner().IsDerivedType() && !symbol->has<ProcEntityDetails>() &&
-        !IsObjectWithDSA(*symbol)) {
+        !symbol->has<SubprogramDetails>() && !IsObjectWithDSA(*symbol)) {
       if (Symbol * found{currScope().FindSymbol(name.source)}) {
         if (symbol != found) {
           name.symbol = found; // adjust the symbol within region



More information about the flang-commits mailing list