[flang-commits] [flang] 4375430 - [flang] Set the addendum when establishing pointer section in descriptor

Jean Perier via flang-commits flang-commits at lists.llvm.org
Mon Nov 8 02:06:58 PST 2021


Author: Jean Perier
Date: 2021-11-08T11:05:31+01:00
New Revision: 437543068935b718d4eac5702e04e8438820b4d2

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

LOG: [flang] Set the addendum when establishing pointer section in descriptor

If the source has an addendum, the descriptor that is being established
to describe a section over the source needs to copy the addendum so that
derived type information is correctly set in the descriptor being
established.

This allows namelist IO with derived type to work correctly.

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

Added: 
    

Modified: 
    flang/runtime/descriptor.cpp

Removed: 
    


################################################################################
diff  --git a/flang/runtime/descriptor.cpp b/flang/runtime/descriptor.cpp
index fcb1c977f0d8..a5524bd55b22 100644
--- a/flang/runtime/descriptor.cpp
+++ b/flang/runtime/descriptor.cpp
@@ -241,6 +241,13 @@ bool Descriptor::EstablishPointerSection(const Descriptor &source,
     }
   }
   raw_.rank = newRank;
+  if (const auto *sourceAddendum = source.Addendum()) {
+    if (auto *addendum{Addendum()}) {
+      *addendum = *sourceAddendum;
+    } else {
+      return false;
+    }
+  }
   return CFI_section(&raw_, &source.raw_, lower, upper, stride) == CFI_SUCCESS;
 }
 


        


More information about the flang-commits mailing list