aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/Cutil.ml
diff options
context:
space:
mode:
authorxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2013-12-30 14:01:44 +0000
committerxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2013-12-30 14:01:44 +0000
commit98089fdf4880b46a57aafa96ea00578e396bb58b (patch)
tree3680fad508c69a7eedc66ba9f163bd2ecc42b132 /cparser/Cutil.ml
parent22fc05453ab31524f9e8439ddd720510fb3a1938 (diff)
downloadcompcert-kvx-98089fdf4880b46a57aafa96ea00578e396bb58b.tar.gz
compcert-kvx-98089fdf4880b46a57aafa96ea00578e396bb58b.zip
Elab.ml: more warnings.
Cutil.ml: fix sizeof calculation of structs. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2391 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'cparser/Cutil.ml')
-rw-r--r--cparser/Cutil.ml9
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