Skip to content

Commit

Permalink
CN: Fix and re-enable formatting
Browse files Browse the repository at this point in the history
c77d645
accidentally deleted the formatting CI check and d7b47b7
committed badly formatted code.

This commit fixes both of the above.
  • Loading branch information
dc-mak committed Jul 30, 2024
1 parent fa710e6 commit 29e8f7c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ jobs:
run: |
opam switch ${{ matrix.version }}
eval $(opam env --switch=${{ matrix.version }})
USE_OPAM='' cd backend/cn && dune build @fmt
- name: Install Cerberus-CHERI
if: ${{ matrix.version == '4.14.1' }}
Expand Down
30 changes: 15 additions & 15 deletions backend/cn/lib/check.ml
Original file line number Diff line number Diff line change
Expand Up @@ -559,21 +559,21 @@ let rec check_pexpr (pe : BT.t mu_pexpr) (k : IT.t -> unit m) : unit m =
let@ model = model () in
let ub = CF.Undefined.UB045a_division_by_zero in
fail (fun ctxt -> { loc; msg = Undefined_behaviour { ub; ctxt; model } })))
| OpRem_t ->
let@ () = WellTyped.ensure_base_type loc ~expect (bt_of_pexpr pe1) in
let@ () = WellTyped.ensure_bits_type loc expect in
let@ () = WellTyped.ensure_bits_type loc (bt_of_pexpr pe2) in
check_pexpr pe1 (fun v1 ->
check_pexpr pe2 (fun v2 ->
let@ provable = provable loc in
let v2_bt = bt_of_pexpr pe2 in
let here = Locations.other __FUNCTION__ in
match provable (t_ (ne_ (v2, int_lit_ 0 v2_bt here) here)) with
| `True -> k (rem_ (v1, v2) loc)
| `False ->
let@ model = model () in
let ub = CF.Undefined.UB045b_modulo_by_zero in
fail (fun ctxt -> {loc; msg = Undefined_behaviour {ub; ctxt; model}})))
| OpRem_t ->
let@ () = WellTyped.ensure_base_type loc ~expect (bt_of_pexpr pe1) in
let@ () = WellTyped.ensure_bits_type loc expect in
let@ () = WellTyped.ensure_bits_type loc (bt_of_pexpr pe2) in
check_pexpr pe1 (fun v1 ->
check_pexpr pe2 (fun v2 ->
let@ provable = provable loc in
let v2_bt = bt_of_pexpr pe2 in
let here = Locations.other __FUNCTION__ in
match provable (t_ (ne_ (v2, int_lit_ 0 v2_bt here) here)) with
| `True -> k (rem_ (v1, v2) loc)
| `False ->
let@ model = model () in
let ub = CF.Undefined.UB045b_modulo_by_zero in
fail (fun ctxt -> { loc; msg = Undefined_behaviour { ub; ctxt; model } })))
| OpEq ->
let@ () = WellTyped.ensure_base_type loc ~expect Bool in
let@ () =
Expand Down

0 comments on commit 29e8f7c

Please sign in to comment.