[flang-commits] [flang] [Flang][HLFIR] Lower PACK(array, .TRUE.) to hlfir.reshape (PR #220860)

via flang-commits flang-commits at lists.llvm.org
Fri Sep 4 03:00:33 PDT 2026


================
@@ -493,6 +493,8 @@ unsigned getBoxCorank(mlir::Type ty) {
 
 /// Return the ISO_C_BINDING intrinsic module value of type \p ty.
 int getTypeCode(mlir::Type ty, const fir::KindMapping &kindMap) {
+  if (mlir::isa<mlir::IndexType>(ty))
+    return CFI_type_ptrdiff_t;
----------------
ejose02 wrote:

Needed so the pack(array, .TRUE.) SHAPE temp (!hlfir.expr<1xindex>) can be emboxed. Without it, getTypeCode() hits unsupported integer type (the crash that caused the revert the previous PR). CFI_index_t is ptrdiff_t in the CFI headers, which is why we map to CFI_type_ptrdiff_t.

https://github.com/llvm/llvm-project/pull/220860


More information about the flang-commits mailing list