Skip to content
Snippets Groups Projects
Commit 30e29676 authored by Patrick Baudin's avatar Patrick Baudin
Browse files

[wp] explicits offset of an union field

parent 60bc2c1e
No related branches found
No related tags found
No related merge requests found
......@@ -464,9 +464,12 @@ let sizeof_object = function
WpLog.fatal ~current:true "Sizeof unknown-size array"
let field_offset fd =
let ctype = TComp(fd.fcomp,Cil.empty_size_cache(),[]) in
let offset = Field(fd,NoOffset) in
fst (Cil.bitsOffset ctype offset) / 8
if fd.fcomp.cstruct then (* C struct *)
let ctype = TComp(fd.fcomp,Cil.empty_size_cache(),[]) in
let offset = Field(fd,NoOffset) in
fst (Cil.bitsOffset ctype offset) / 8
else (* CIL invariant: all C union fields start at offset 0 *)
0
(* Conforms to C-ISO 6.3.1.8 *)
(* If same sign => greater rank. *)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment