================
@@ -1661,6 +1661,20 @@ 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()) {
+ // Packed records have no inter-field alignment gaps and no tail padding.
+ // LLVM lowers them to packed structs (e.g. <{ i32, double }>) whose ABI
+ // alignment is 1. Sum the raw component sizes without any rounding.
+ for (auto component : recTy.getTypeList()) {
+ auto result =
+ getTypeSizeAndAlignment(loc, component.second, dl, kindMap);
+ if (!result)
+ return result;
+ auto [compSize, compAlign] = *result;
+ size += llvm::alignTo(compSize, compAlign);
----------------
DanielCChen wrote:
Fixed.
https://github.com/llvm/llvm-project/pull/216164
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits