[flang-commits] [flang] [flang] Fix RecordType sizes, TRANSFER lowering, and BIND(C) ABI on SystemZ/PPC64le (PR #220377)

via flang-commits flang-commits at lists.llvm.org
Fri Sep 4 23:33:37 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);
----------------
MattPD wrote:

Confirmed that transfer sizing now uses representation width consistently for both the source and the result.

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


More information about the flang-commits mailing list