[flang-commits] [flang] [Flang] Extra check for character length in pointer allocation (PR #95145)

Carlos Seo via flang-commits flang-commits at lists.llvm.org
Thu Jun 13 08:53:48 PDT 2024


================
@@ -418,14 +418,17 @@ static bool HaveCompatibleTypeParameters(
   }
 }
 
-static bool HaveCompatibleLengths(
-    const DeclTypeSpec &type1, const DeclTypeSpec &type2) {
+static bool HaveCompatibleLengths(const DeclTypeSpec &type1,
+    const DeclTypeSpec &type2, const Symbol &symbol) {
   if (type1.category() == DeclTypeSpec::Character &&
       type2.category() == DeclTypeSpec::Character) {
     auto v1{
         evaluate::ToInt64(type1.characterTypeSpec().length().GetExplicit())};
     auto v2{
         evaluate::ToInt64(type2.characterTypeSpec().length().GetExplicit())};
+    if (!type1.characterTypeSpec().length().isDeferred() && IsPointer(symbol) &&
+        !v1 && v2)
----------------
ceseo wrote:

Ack

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


More information about the flang-commits mailing list