From 7ad7c4ea86d972ede80a7856909f513b08e3b584 Mon Sep 17 00:00:00 2001 From: Peter Steinfeld Date: Wed, 5 Oct 2022 14:02:59 -0700 Subject: [PATCH] [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 --- flang/lib/Lower/ConvertExpr.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/flang/lib/Lower/ConvertExpr.cpp b/flang/lib/Lower/ConvertExpr.cpp index 58b06ef..843e187 100644 --- a/flang/lib/Lower/ConvertExpr.cpp +++ b/flang/lib/Lower/ConvertExpr.cpp @@ -1625,6 +1625,9 @@ public: mlir::IndexType idxTy = builder.getIndexType(); Fortran::evaluate::ConstantSubscript size = Fortran::evaluate::GetSize(con.shape()); + if (size > std::numeric_limits::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) -- 2.7.4