[flang-commits] [flang] [flang] Fix issues with STORAGE_SIZE and characters (PR #67561)

via flang-commits flang-commits at lists.llvm.org
Wed Sep 27 10:51:57 PDT 2023


================
@@ -836,4 +836,15 @@ bool IsCUDAIntrinsicType(const DynamicType &type) {
   }
 }
 
+DynamicType DynamicType::DropNonConstantParameters() const {
+  if (charLengthParamValue_ && charLengthParamValue_->isExplicit()) {
+    if (std::optional<std::int64_t> len = knownLength()) {
+      return DynamicType(kind_, *len);
+    } else {
+      return DynamicType(category_, kind_);
+    }
+  }
+  return *this;
----------------
jeanPerier wrote:

Thanks for mentioning them, this is not as easy as for characters since this would require allocating new DerivedTypeSpec somewhere where they can survive long enough.
I cannot expose any bugs right now with this since the storage size of PDTs is a compile time constant with flang design, so I renamed this helper to be character specific and added a TODO note in FunctionRef<T>::GetType and a storage_type rewrite test with PDTs.

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


More information about the flang-commits mailing list