[flang-commits] [flang] a29d746 - [flang] Only apply PointerIsAssociatedWith fix for derived-type

Valentin Clement via flang-commits flang-commits at lists.llvm.org
Thu Mar 9 07:11:08 PST 2023


Author: Valentin Clement
Date: 2023-03-09T16:06:34+01:00
New Revision: a29d746377f70d517929830e18c20d7d5128ceab

URL: https://github.com/llvm/llvm-project/commit/a29d746377f70d517929830e18c20d7d5128ceab
DIFF: https://github.com/llvm/llvm-project/commit/a29d746377f70d517929830e18c20d7d5128ceab.diff

LOG: [flang] Only apply PointerIsAssociatedWith fix for derived-type

Only apply the change made in D145604 for derived-type.
zero-sized character for example are supposed to give a false result

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D145675

Added: 
    

Modified: 
    flang/runtime/pointer.cpp

Removed: 
    


################################################################################
diff  --git a/flang/runtime/pointer.cpp b/flang/runtime/pointer.cpp
index a0a11e96a6883..216e8c70be029 100644
--- a/flang/runtime/pointer.cpp
+++ b/flang/runtime/pointer.cpp
@@ -206,7 +206,8 @@ bool RTNAME(PointerIsAssociatedWith)(
   if (!target) {
     return pointer.raw().base_addr != nullptr;
   }
-  if (!target->raw().base_addr) {
+  if (!target->raw().base_addr ||
+      (target->raw().type != CFI_type_struct && target->ElementBytes() == 0)) {
     return false;
   }
   int rank{pointer.rank()};


        


More information about the flang-commits mailing list