[flang-commits] [flang] [flang] Fix `getTypeSizeAndAlignment` for packed/tail-padded `RecordType` and `TRANSFER` gate (PR #220377)
Daniel Chen via flang-commits
flang-commits at lists.llvm.org
Fri Sep 4 07:52:16 PDT 2026
================
@@ -8904,10 +8904,15 @@ IntrinsicLibrary::genTransfer(mlir::Type resultType,
(fir::isa_trivial(sourceType) ||
mlir::isa<fir::RecordType>(sourceType)) &&
fir::isa_trivial(moldType)) {
+ // Use storeSizeOnly=true so that tail padding in RecordType sources is
+ // excluded: TRANSFER reinterprets raw data bits, so the comparison must
+ // be against the store size (data bytes), not the allocation size.
auto sourceSizeAndAlign = fir::getTypeSizeAndAlignment(
- loc, sourceType, builder.getDataLayout(), builder.getKindMap());
+ loc, sourceType, builder.getDataLayout(), builder.getKindMap(),
+ /*storeSizeOnly=*/true);
----------------
DanielCChen wrote:
Oh, the branch got messed up a bit. I restored it.
Sorry about that.
https://github.com/llvm/llvm-project/pull/220377
More information about the flang-commits
mailing list