From: Robert Pengelly Date: Sat, 31 Oct 2026 10:20:35 +0000 (+0000) Subject: Fix trailing padding in aggregate static initializers X-Git-Url: https://git.candlhat.org/?a=commitdiff_plain;h=cdfbcfea01247fbc8a539d78ae0b482f20374a57;p=scc.git Fix trailing padding in aggregate static initializers --- 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; + } {