let field_offset f =
  let rec acc ofs f = function
    | [] -> assert false
    | fi::m ->
        if Cil_datatype.Fieldinfo.equal f fi then ofs else
          let sf = sizeof_object (object_of fi.ftype) in
          acc (Int64.add ofs sf) f m
  in acc Int64.zero f f.fcomp.cfields