[flang-commits] [flang] be30cd6 - [flang][lowering] Move PDT TODO before length param type lowering (#67650)

via flang-commits flang-commits at lists.llvm.org
Thu Sep 28 08:09:27 PDT 2023


Author: jeanPerier
Date: 2023-09-28T17:09:23+02:00
New Revision: be30cd62a94ebd941b787f101363a584f220b2d3

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

LOG: [flang][lowering] Move PDT TODO before length param type lowering (#67650)

There is a crash before hitting the TODO when the length parameter kind
depends on a KIND parameter. I do not want to fix it since I cannot test
it because of the TODO, so I just moved to TODO up and added a comment.

Added: 
    

Modified: 
    flang/lib/Lower/ConvertType.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Lower/ConvertType.cpp b/flang/lib/Lower/ConvertType.cpp
index bfddf9a15084c85..efaeba29b762ad4 100644
--- a/flang/lib/Lower/ConvertType.cpp
+++ b/flang/lib/Lower/ConvertType.cpp
@@ -403,21 +403,26 @@ struct TypeBuilderImpl {
       cs.emplace_back(converter.getRecordTypeFieldName(component), ty);
     }
 
+    mlir::Location loc = converter.genLocation(typeSymbol.name());
     // (2) The LEN type parameters.
     for (const auto &param :
          Fortran::semantics::OrderParameterDeclarations(typeSymbol))
       if (param->get<Fortran::semantics::TypeParamDetails>().attr() ==
-          Fortran::common::TypeParamAttr::Len)
+          Fortran::common::TypeParamAttr::Len) {
+        TODO(loc, "parameterized derived types");
+        // TODO: emplace in ps. Beware that param is the symbol in the type
+        // declaration, not instantiation: its kind may not be a constant.
+        // The instantiated symbol in tySpec.scope should be used instead.
         ps.emplace_back(param->name().ToString(), genSymbolType(*param));
+      }
 
     rec.finalize(ps, cs);
     popDerivedTypeInConstruction();
 
-    mlir::Location loc = converter.genLocation(typeSymbol.name());
     if (!ps.empty()) {
-      // This type is a PDT (parametric derived type). Create the functions to
-      // use for allocation, dereferencing, and address arithmetic here.
-      TODO(loc, "parameterized derived types");
+      // TODO: this type is a PDT (parametric derived type) with length
+      // parameter. Create the functions to use for allocation, dereferencing,
+      // and address arithmetic here.
     }
     LLVM_DEBUG(llvm::dbgs() << "derived type: " << rec << '\n');
 


        


More information about the flang-commits mailing list