Skip to content

Conversation

@kparzysz
Copy link
Contributor

No description provided.

@kparzysz kparzysz requested review from Stylie777 and tblah October 18, 2025 13:54
@llvmbot llvmbot added flang Flang issues not falling into any other category flang:openmp flang:semantics labels Oct 18, 2025
@llvmbot
Copy link
Member

llvmbot commented Oct 18, 2025

@llvm/pr-subscribers-flang-semantics

@llvm/pr-subscribers-flang-openmp

Author: Krzysztof Parzyszek (kparzysz)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/164087.diff

2 Files Affected:

  • (modified) flang/lib/Semantics/check-omp-atomic.cpp (+1-1)
  • (modified) flang/lib/Semantics/resolve-directives.cpp (+1-1)
diff --git a/flang/lib/Semantics/check-omp-atomic.cpp b/flang/lib/Semantics/check-omp-atomic.cpp
index 515121af04d56..2707921ca1dfa 100644
--- a/flang/lib/Semantics/check-omp-atomic.cpp
+++ b/flang/lib/Semantics/check-omp-atomic.cpp
@@ -286,7 +286,7 @@ static std::optional<AnalyzedCondStmt> AnalyzeConditionalStmt(
   // Extract the evaluate::Expr from ScalarLogicalExpr.
   auto getFromLogical{[](const parser::ScalarLogicalExpr &logical) {
     // ScalarLogicalExpr is Scalar<Logical<common::Indirection<Expr>>>
-    const parser::Expr &expr{logical.thing.thing.value()};
+    auto &expr{parser::UnwrapRef<parser::Expr>(logical)};
     return GetEvaluateExpr(expr);
   }};
 
diff --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp
index 7067ed3d99286..8fe5fd83ee6d8 100644
--- a/flang/lib/Semantics/resolve-directives.cpp
+++ b/flang/lib/Semantics/resolve-directives.cpp
@@ -560,7 +560,7 @@ class OmpAttributeVisitor : DirectiveAttributeVisitor<llvm::omp::Directive> {
     auto getArgument{[&](auto &&maybeClause) {
       if (maybeClause) {
         // Scalar<Logical<Constant<common::Indirection<Expr>>>>
-        auto &parserExpr{maybeClause->v.thing.thing.thing.value()};
+        auto &parserExpr{parser::UnwrapRef<parser::Expr>(*maybeClause)};
         evaluate::ExpressionAnalyzer ea{context_};
         if (auto &&maybeExpr{ea.Analyze(parserExpr)}) {
           if (auto v{omp::GetLogicalValue(*maybeExpr)}) {

Copy link
Contributor

@tblah tblah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

@kparzysz kparzysz merged commit 34cf8bb into main Oct 21, 2025
14 checks passed
@kparzysz kparzysz deleted the users/kparzysz/unwrap-ref branch October 21, 2025 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flang:openmp flang:semantics flang Flang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants