[flang-commits] [flang] [Flang][OpenMP] Fix type in getBaseObject causing crashes in certain scenarios (PR #95472)

via flang-commits flang-commits at lists.llvm.org
Thu Jun 13 13:54:16 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-fir-hlfir

Author: None (agozillon)

<details>
<summary>Changes</summary>

This typo would unfortunately cause code like the following to ICE, where common block symbols/names are used in a map clause:

subroutine sb()
  implicit none
  integer:: b, c
  common /var/ b, c

!$omp target map(tofrom: /var/)
   b = 1
   c = 2
!$omp end target
end subroutine

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


1 Files Affected:

- (modified) flang/lib/Lower/OpenMP/Clauses.cpp (+1-1) 


``````````diff
diff --git a/flang/lib/Lower/OpenMP/Clauses.cpp b/flang/lib/Lower/OpenMP/Clauses.cpp
index 1e3fea7c4cdc7..6bae62cd85860 100644
--- a/flang/lib/Lower/OpenMP/Clauses.cpp
+++ b/flang/lib/Lower/OpenMP/Clauses.cpp
@@ -153,7 +153,7 @@ Object makeObject(const parser::OmpObject &object,
 std::optional<Object> getBaseObject(const Object &object,
                                     semantics::SemanticsContext &semaCtx) {
   // If it's just the symbol, then there is no base.
-  if (!object.id())
+  if (!object.ref())
     return std::nullopt;
 
   auto maybeRef = evaluate::ExtractDataRef(*object.ref());

``````````

</details>


https://github.com/llvm/llvm-project/pull/95472


More information about the flang-commits mailing list