Skip to content

Commit 1ee5cdd

Browse files
committed
Update Cerberus commit for Byte C type
1 parent b70210d commit 1ee5cdd

File tree

9 files changed

+14
-6
lines changed

9 files changed

+14
-6
lines changed

cn.opam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ depends: [
2323
"zarith" {>= "1.13"}
2424
]
2525
pin-depends: [
26-
["cerberus-lib.dev" "git+https://github.com/rems-project/cerberus.git#881feae"]
26+
["cerberus-lib.dev" "git+https://github.com/rems-project/cerberus.git#718ca6c0"]
2727
]
2828
build: [
2929
["dune" "subst"] {pinned}

lib/baseTypes.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ let rec of_sct loc is_signed size_of = function
137137
Map (uintptr_bt loc is_signed size_of, of_sct loc is_signed size_of sct)
138138
| Pointer sct -> Loc (loc sct)
139139
| Struct tag -> Struct tag
140+
| Byte -> MemByte
140141
| Function _ -> Cerb_debug.error "todo: function types"
141142

142143

lib/bugExplanation/replicators.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ let compile_sct_aux (prog5 : unit Mucore.file) (sct : Sctypes.t)
171171
let b1, s1 =
172172
match sct with
173173
| Void -> failwith __LOC__
174+
| Byte -> failwith ("TODO: Byte case for " ^ __FUNCTION__)
174175
| Integer _ ->
175176
( [ Utils.create_binding buf_sym C.pointer_to_char ],
176177
A.

lib/check.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1762,7 +1762,7 @@ let rec check_expr labels (e : BT.t Mu.expr) (k : IT.t -> unit m) : unit m =
17621762
(* FIXME this hard codes big endianness but this should be switchable *)
17631763
let here = Locations.other __LOC__ in
17641764
match ct with
1765-
| Sctypes.Void | Array (_, _) | Struct _ | Function (_, _, _) ->
1765+
| Sctypes.Void | Array (_, _) | Struct _ | Function (_, _, _) | Byte ->
17661766
fail (fun _ -> { loc; msg = Unsupported_byte_conv_ct ct })
17671767
| Integer it ->
17681768
let bt = IT.get_bt value in

lib/indexTerms.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,7 @@ let value_check mode (struct_layouts : Memory.struct_decls) ct about loc =
974974
let open Memory in
975975
let rec aux (ct_ : Sctypes.t) about =
976976
match ct_ with
977-
| Void -> bool_ true loc
977+
| Void | Byte -> bool_ true loc
978978
| Integer it ->
979979
in_z_range about (Memory.min_integer_type it, Memory.max_integer_type it) loc
980980
| Array (_, None) ->

lib/pack.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ let packing_ft ~full loc global provable ret =
4343
match ret with
4444
| P ret ->
4545
(match ret.name with
46-
| Owned ((Void | Integer _ | Pointer _ | Function _), _init) -> None
46+
| Owned ((Void | Integer _ | Pointer _ | Function _ | Byte), _init) -> None
4747
| Owned ((Array (ict, olength) as ct), init) ->
4848
let qpred = unfolded_array loc init (ict, olength) ret.pointer in
4949
let o_s, o = IT.fresh_named (Memory.bt_of_sct ct) "value" loc in
@@ -104,7 +104,7 @@ let packing_ft ~full loc global provable ret =
104104
let unpack_owned loc global (ct, init) pointer (O o) =
105105
let open Sctypes in
106106
match ct with
107-
| Void | Integer _ | Pointer _ | Function _ -> None
107+
| Void | Integer _ | Pointer _ | Function _ | Byte -> None
108108
| Array (ict, olength) -> Some [ (unfolded_array loc init (ict, olength) pointer, O o) ]
109109
| Struct tag ->
110110
let layout = Sym.Map.find tag global.Global.struct_decls in

lib/pp_mucore_coq.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,8 @@ let rec pp_ctype (Ctype.Ctype (annots, ct)) =
691691
pp_constructor "Ctype.Pointer" [ pp_qualifiers quals; pp_ctype ct ]
692692
| Ctype.Atomic ct -> pp_constructor "Ctype.Atomic" [ pp_ctype ct ]
693693
| Ctype.Struct sym -> pp_constructor "Ctype.Struct" [ pp_symbol sym ]
694-
| Ctype.Union sym -> pp_constructor "Ctype.Union" [ pp_symbol sym ])
694+
| Ctype.Union sym -> pp_constructor "Ctype.Union" [ pp_symbol sym ]
695+
| Ctype.Byte -> pp_constructor0 "Ctype.Byte")
695696
]
696697

697698

@@ -726,6 +727,7 @@ let rec pp_sctype = function
726727
pp_bool variadic
727728
]
728729
]
730+
| Sctypes.Byte -> pp_constructor0 "SCtypes.Byte"
729731

730732

731733
let rec pp_core_base_type = function

lib/sctypes.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ type ctype =
8080
(qualifiers * ctype)
8181
* (ctype * (* is_register *) bool) list
8282
* (* is_variadic *) bool
83+
| Byte
8384
[@@deriving eq, ord]
8485

8586
type t = ctype
@@ -142,6 +143,7 @@ let rec to_ctype (ct_ : ctype) =
142143
| Array (t, oi) -> Array (to_ctype t, Option.map Z.of_int oi)
143144
| Pointer t -> Pointer (Ctype.no_qualifiers, to_ctype t)
144145
| Struct t -> Struct t
146+
| Byte -> Byte
145147
| Function ((ret_q, ret_ct), args, variadic) ->
146148
let args =
147149
List.map
@@ -184,6 +186,7 @@ let rec of_ctype (Ctype.Ctype (_, ct_)) =
184186
return (Pointer t)
185187
| Ctype.Atomic _ -> None
186188
| Ctype.Struct s -> return (Struct s)
189+
| Byte -> return Byte
187190
| Union _ -> fail
188191

189192

lib/wellTyped.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ module WCT = struct
325325
let@ _struct_decl = get_struct_decl loc tag in
326326
return ()
327327
| Function ((_, rct), args, _) -> ListM.iterM aux (rct :: List.map fst args)
328+
| Byte -> return ()
328329
in
329330
fun ct -> aux ct
330331
end

0 commit comments

Comments
 (0)