[flang-commits] [flang] [flang][OpenMP] Fix symbol handling in critical constructs (PR #90671)

Leandro Lupori via flang-commits flang-commits at lists.llvm.org
Tue Apr 30 14:43:15 PDT 2024


https://github.com/luporl created https://github.com/llvm/llvm-project/pull/90671

Fixes https://github.com/llvm/llvm-project/issues/78936


>From 67c59988893856f47dd4917da9d5d7d026eed52f Mon Sep 17 00:00:00 2001
From: Leandro Lupori <leandro.lupori at linaro.org>
Date: Tue, 30 Apr 2024 18:38:29 -0300
Subject: [PATCH] [flang][OpenMP] Fix symbol handling in critical constructs

Fixes https://github.com/llvm/llvm-project/issues/78936
---
 flang/lib/Semantics/resolve-directives.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp
index 318687508ff1f5..314c7cf13e90b5 100644
--- a/flang/lib/Semantics/resolve-directives.cpp
+++ b/flang/lib/Semantics/resolve-directives.cpp
@@ -1823,6 +1823,7 @@ bool OmpAttributeVisitor::Pre(const parser::OpenMPCriticalConstruct &x) {
   const auto &beginCriticalDir{std::get<parser::OmpCriticalDirective>(x.t)};
   const auto &endCriticalDir{std::get<parser::OmpEndCriticalDirective>(x.t)};
   PushContext(beginCriticalDir.source, llvm::omp::Directive::OMPD_critical);
+  GetContext().withinConstruct = true;
   if (const auto &criticalName{
           std::get<std::optional<parser::Name>>(beginCriticalDir.t)}) {
     ResolveOmpName(*criticalName, Symbol::Flag::OmpCriticalLock);



More information about the flang-commits mailing list