[flang-commits] [clang] [flang] [llvm] [flang] Add -finit-local= to initialize automatic variables (PR #216164)
Daniel Chen via flang-commits
flang-commits at lists.llvm.org
Tue Sep 1 10:52:25 PDT 2026
================
@@ -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
More information about the flang-commits
mailing list