[flang-commits] [flang] [Flang][HLFIR] Lower PACK(array, .TRUE.) to hlfir.reshape (PR #213603)
via flang-commits
flang-commits at lists.llvm.org
Wed Aug 19 02:39:45 PDT 2026
ejose02 wrote:
Thanks for reporting this, @sscalpone .I can reproduce the failure on pack(c, mask=.true.) and agree it’s from this patch.
Root cause: the PACK fast path builds the temporary SHAPE as !hlfir.expr<1xindex>. That index-typed temp hits fir::getTypeCode() during embox lowering and aborts. Extent math in index is fine; the issue is the SHAPE element type.
Fix options:
1. Use default Fortran integer for the PACK SHAPE temp (PACK-only, low risk)
2. Teach codegen to handle index in getTypeCode/embox (broader change).
@vzakhari — which direction do you prefer? I’ll put up a follow-up fix accordingly.
https://github.com/llvm/llvm-project/pull/213603
More information about the flang-commits
mailing list