From 6790220e03d0e3a997ff1f1a44485c58e5322e03 Mon Sep 17 00:00:00 2001 From: Valentin Clement Date: Wed, 16 Aug 2023 15:12:15 -0700 Subject: [PATCH] [flang][openacc] Fix name resolution on routine bind clause Reviewed By: razvanlupusoru Differential Revision: https://reviews.llvm.org/D158120 --- flang/lib/Semantics/resolve-directives.cpp | 2 +- flang/test/Semantics/OpenACC/acc-routine.f90 | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp index 2ecdfca18c6b4..69cd6930c3cf7 100644 --- a/flang/lib/Semantics/resolve-directives.cpp +++ b/flang/lib/Semantics/resolve-directives.cpp @@ -846,7 +846,7 @@ bool AccAttributeVisitor::Pre(const parser::OpenACCRoutineConstruct &x) { bool AccAttributeVisitor::Pre(const parser::AccBindClause &x) { if (const auto *name{std::get_if(&x.u)}) { - if (!ResolveName(*name)) { + if (!ResolveName(*name, true)) { context_.Say(name->source, "No function or subroutine declared for '%s'"_err_en_US, name->source); diff --git a/flang/test/Semantics/OpenACC/acc-routine.f90 b/flang/test/Semantics/OpenACC/acc-routine.f90 index f6176dd9c2f3e..4dcb849c642c8 100644 --- a/flang/test/Semantics/OpenACC/acc-routine.f90 +++ b/flang/test/Semantics/OpenACC/acc-routine.f90 @@ -9,3 +9,7 @@ subroutine sub2(a) real, dimension(10) :: a call sub1(a) end subroutine + +subroutine sub3() + !$acc routine bind(sub1) +end subroutine