[flang-commits] [flang] 7ad7c4e - [flang] Add a "not yet implemented" message for large, constant arrays

Peter Steinfeld via flang-commits flang-commits at lists.llvm.org
Thu Oct 6 08:55:03 PDT 2022


Author: Peter Steinfeld
Date: 2022-10-06T08:54:20-07:00
New Revision: 7ad7c4ea86d972ede80a7856909f513b08e3b584

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

LOG: [flang] Add a "not yet implemented" message for large, constant arrays

Rather than crashing in llvm code, nip things in the bud.

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

Added: 
    

Modified: 
    flang/lib/Lower/ConvertExpr.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Lower/ConvertExpr.cpp b/flang/lib/Lower/ConvertExpr.cpp
index 58b06ef72b84..843e18774cbf 100644
--- a/flang/lib/Lower/ConvertExpr.cpp
+++ b/flang/lib/Lower/ConvertExpr.cpp
@@ -1625,6 +1625,9 @@ class ScalarExprLowering {
     mlir::IndexType idxTy = builder.getIndexType();
     Fortran::evaluate::ConstantSubscript size =
         Fortran::evaluate::GetSize(con.shape());
+    if (size > std::numeric_limits<std::uint32_t>::max())
+      // llvm::SmallVector has limited size
+      TODO(getLoc(), "Creation of very large array constants");
     fir::SequenceType::Shape shape(con.shape().begin(), con.shape().end());
     mlir::Type eleTy;
     if constexpr (TC == Fortran::common::TypeCategory::Character)


        


More information about the flang-commits mailing list