Skip to content

[flang][lowering] Move PDT TODO before length param type lowering #67650

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 28, 2023

Conversation

jeanPerier
Copy link
Contributor

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.

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.
@llvmbot llvmbot added flang Flang issues not falling into any other category flang:fir-hlfir labels Sep 28, 2023
@llvmbot
Copy link
Member

llvmbot commented Sep 28, 2023

@llvm/pr-subscribers-flang-fir-hlfir

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/67650.diff

1 Files Affected:

  • (modified) flang/lib/Lower/ConvertType.cpp (+10-5)
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');
 

Copy link
Contributor

@psteinfeld psteinfeld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All builds and tests correctly and looks good.

@jeanPerier jeanPerier merged commit be30cd6 into llvm:main Sep 28, 2023
@jeanPerier jeanPerier deleted the jp-weird-pdt-crash branch September 28, 2023 15:09
legrosbuffle pushed a commit to legrosbuffle/llvm-project that referenced this pull request Sep 29, 2023
…vm#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang:fir-hlfir flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants