Skip to content

Commit

Permalink
Merge pull request #174 from AeneasVerif/bump-charon
Browse files Browse the repository at this point in the history
Update charon
  • Loading branch information
Nadrieril authored May 6, 2024
2 parents a935064 + 87da554 commit 5c758f8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
3 changes: 3 additions & 0 deletions compiler/ExtractTypes.ml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ let extract_binop (meta : Meta.meta)
| Add -> "+"
| Sub -> "-"
| Mul -> "*"
| CheckedAdd | CheckedSub | CheckedMul ->
craise __FILE__ __LINE__ meta
"Checked operations are not implemented"
| Shl -> "<<<"
| Shr -> ">>>"
| BitXor -> "^^^"
Expand Down
12 changes: 9 additions & 3 deletions compiler/InterpreterExpressions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ let eval_binary_op_concrete_compute (meta : Meta.meta) (binop : binop)
| Ge -> Z.geq sv1.value sv2.value
| Gt -> Z.gt sv1.value sv2.value
| Div | Rem | Add | Sub | Mul | BitXor | BitAnd | BitOr | Shl
| Shr | Ne | Eq ->
| Shr | Ne | Eq | CheckedAdd | CheckedSub | CheckedMul ->
craise __FILE__ __LINE__ meta "Unreachable"
in
Ok
Expand All @@ -575,7 +575,8 @@ let eval_binary_op_concrete_compute (meta : Meta.meta) (binop : binop)
| BitXor -> raise Unimplemented
| BitAnd -> raise Unimplemented
| BitOr -> raise Unimplemented
| Lt | Le | Ge | Gt | Shl | Shr | Ne | Eq ->
| Lt | Le | Ge | Gt | Shl | Shr | Ne | Eq | CheckedAdd
| CheckedSub | CheckedMul ->
craise __FILE__ __LINE__ meta "Unreachable"
in
match res with
Expand All @@ -586,7 +587,8 @@ let eval_binary_op_concrete_compute (meta : Meta.meta) (binop : binop)
value = VLiteral (VScalar sv);
ty = TLiteral (TInteger sv1.int_ty);
})
| Shl | Shr -> raise Unimplemented
| Shl | Shr | CheckedAdd | CheckedSub | CheckedMul ->
craise __FILE__ __LINE__ meta "Unimplemented binary operation"
| Ne | Eq -> craise __FILE__ __LINE__ meta "Unreachable")
| _ -> craise __FILE__ __LINE__ meta "Invalid inputs for binop"

Expand Down Expand Up @@ -633,6 +635,10 @@ let eval_binary_op_symbolic (config : config) (meta : Meta.meta) (binop : binop)
| Div | Rem | Add | Sub | Mul | BitXor | BitAnd | BitOr ->
sanity_check __FILE__ __LINE__ (int_ty1 = int_ty2) meta;
TLiteral (TInteger int_ty1)
(* These return `(int, bool)` which isn't a literal type *)
| CheckedAdd | CheckedSub | CheckedMul ->
craise __FILE__ __LINE__ meta
"Checked operations are not implemented"
| Shl | Shr ->
(* The number of bits can be of a different integer type
than the operand *)
Expand Down
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5c758f8

Please sign in to comment.