From cdfbcfea01247fbc8a539d78ae0b482f20374a57 Mon Sep 17 00:00:00 2001 From: Robert Pengelly Date: Sat, 31 Oct 2026 10:20:35 +0000 Subject: [PATCH] Fix trailing padding in aggregate static initializers --- parse.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/parse.c b/parse.c index 394e24f..7b8bc9a 100644 --- a/parse.c +++ b/parse.c @@ -3722,7 +3722,15 @@ void parse_type_spec (void) { } if (!aggregate_is_packed) { - aggregate_size = (int) align_up_long (aggregate_size, aggregate_align); + + int aligned_size = (int) align_up_long (aggregate_size, aggregate_align); + + if (!is_union && aligned_size > aggregate_size && aggregate_field_count < MAX_AGG_FIELDS) { + aggregate_fields[aggregate_field_count++] = -(aligned_size - aggregate_size); + } + + aggregate_size = aligned_size; + } { -- 2.34.1