diff options
Diffstat (limited to 'cparser/Cutil.ml')
-rw-r--r-- | cparser/Cutil.ml | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/cparser/Cutil.ml b/cparser/Cutil.ml index ea4a905d..302c1cfe 100644 --- a/cparser/Cutil.ml +++ b/cparser/Cutil.ml @@ -397,9 +397,14 @@ let sizeof_union env members = let sizeof_struct env members = let rec sizeof_rec ofs = function - | [] | [ { fld_typ = TArray(_, None, _) } ] -> - (* C99: ty[] allowed as last field *) + | [] -> Some ofs + | [ { fld_typ = TArray(_, None, _) } as m ] -> + (* C99: ty[] allowed as last field *) + begin match alignof env m.fld_typ with + | Some a -> Some (align ofs a) + | None -> None + end | m :: rem as ml -> if m.fld_bitfield = None then begin match alignof env m.fld_typ, sizeof env m.fld_typ with |