[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
Thu Sep 10 01:29:57 PDT 2026
================
@@ -1661,15 +1663,40 @@ fir::getTypeSizeAndAlignment(mlir::Location loc, mlir::Type ty,
if (auto recTy = mlir::dyn_cast<fir::RecordType>(ty)) {
std::uint64_t size = 0;
unsigned short align = 1;
+ if (recTy.isPacked()) {
+ // LLVM packed structs (<{ ... }>) place fields back-to-back with no
+ // inter-field alignment padding and no tail padding. Each component
+ // still occupies its allocation size (llvm::alignTo(storeSize, ABI
+ // alignment)), because LLVM's packed StructLayout advances by
+ // getTypeAllocSize, not getTypeStoreSize. For example, x86 f80 has
----------------
MattPD wrote:
The suggestion I left on [your `-finit-local` PR](https://github.com/llvm/llvm-project/pull/216164#discussion_r3976119324) seems relevant here too. Would you be open to dropping the `Tests` table and `Related` paragraph? They can help during review, but the test-specific detail belongs with the tests, and the allocation issue is already fixed in the base.
The message already has useful context for future maintainers: the sizing distinction, the aligned byte-copy rationale, and the ABI implications. I'd keep that and drop the unqualified "always returns the allocation extent" claim, rather than expand it with API exceptions the header already documents.
https://github.com/llvm/llvm-project/pull/220377
More information about the flang-commits
mailing list