[flang-commits] [flang] 280a3e4 - [flang][hlfir] Added a TODO note for parameterized array component shapes.

Slava Zakharin via flang-commits flang-commits at lists.llvm.org
Fri May 19 08:21:13 PDT 2023


Author: Slava Zakharin
Date: 2023-05-19T08:21:07-07:00
New Revision: 280a3e44a325d60d87ebed96f99608df5e07d683

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

LOG: [flang][hlfir] Added a TODO note for parameterized array component shapes.

Without the TODO, MLIR verifier fails because of invalid hlfir.declare
or fir.alloca that lowering produces.

Reviewed By: clementval

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

Added: 
    

Modified: 
    flang/lib/Lower/ConvertExprToHLFIR.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Lower/ConvertExprToHLFIR.cpp b/flang/lib/Lower/ConvertExprToHLFIR.cpp
index bfa84be04637..e70a9182ad6c 100644
--- a/flang/lib/Lower/ConvertExprToHLFIR.cpp
+++ b/flang/lib/Lower/ConvertExprToHLFIR.cpp
@@ -594,8 +594,17 @@ class HlfirDesignatorBuilder {
     llvm::SmallVector<mlir::Value> extents;
     auto seqTy = hlfir::getFortranElementOrSequenceType(fieldType)
                      .cast<fir::SequenceType>();
-    for (auto extent : seqTy.getShape())
+    for (auto extent : seqTy.getShape()) {
+      if (extent == fir::SequenceType::getUnknownExtent()) {
+        // We have already generated invalid hlfir.declare
+        // without the type parameters and probably invalid storage
+        // for the variable (e.g. fir.alloca without type parameters).
+        // So this TODO here is a little bit late, but it matches
+        // the non-HLFIR path.
+        TODO(loc, "array component shape depending on length parameters");
+      }
       extents.push_back(builder.createIntegerConstant(loc, idxTy, extent));
+    }
     if (!hasNonDefaultLowerBounds(componentSym))
       return builder.create<fir::ShapeOp>(loc, extents);
 


        


More information about the flang-commits mailing list