[flang-commits] [flang] [flang] Fix `getTypeSizeAndAlignment` for packed/tail-padded `RecordType` and `TRANSFER` gate (PR #220377)
via flang-commits
flang-commits at lists.llvm.org
Thu Sep 3 23:02:34 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 head still contains two commits. `1cb6fea4e527` contains an aggregate-copy implementation that produces the wrong result. `c5025ead076c` fixes that bug and adds the final LLVM IR and SystemZ tests, but its commit message has no body. The PR body still describes the superseded implementation and mentions only two test files.
Could the commits be squashed and the PR body updated to describe the final implementation and all added tests? Would the change to argument passing for `BIND(C)` and `VALUE` records on SystemZ and PPC64le also warrant a release note?
https://github.com/llvm/llvm-project/pull/220377
More information about the flang-commits
mailing list