Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fixes #247

Merged
merged 3 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
## Unreleased

### Added

### Fixed

- Fixes incorrect type calculation of bitv `*_extend` ops
- Bumps bitwuzla 0.4.0 -> 0.6.0 to fix segmentation faults

### Changed

## v0.3.0
Expand Down
2 changes: 1 addition & 1 deletion smtml.opam
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ available: arch != "arm32" & arch != "x86_32"
pin-depends: [
["colibri2.0.4.0" "git+https://git.frama-c.com/pub/colibrics.git#1feba887bbb7980f27bbcec8137eb908caa8f0ce"]
["colibrilib.0.4.0" "git+https://git.frama-c.com/pub/colibrics.git#1feba887bbb7980f27bbcec8137eb908caa8f0ce"]
["alt-ergo-lib.dev" "git+https://github.com/OCamlPro/alt-ergo.git#7ee96296a5de9588a4d585b3b8abec35f4755425"]
["alt-ergo-lib.2.6.0" "git+https://github.com/OCamlPro/alt-ergo.git#7ee96296a5de9588a4d585b3b8abec35f4755425"]
["cvc5.dev" "git+https://github.com/formalsec/ocaml-cvc5.git#b7aade52d49a19d646036d7e6aac09039c3e95cf"]
["benchpress.dev" "git+https://github.com/filipeom/benchpress.git#50355de32835b12f1b065a4700f493bc3d8c5342"]
]
2 changes: 1 addition & 1 deletion smtml.opam.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ available: arch != "arm32" & arch != "x86_32"
pin-depends: [
["colibri2.0.4.0" "git+https://git.frama-c.com/pub/colibrics.git#1feba887bbb7980f27bbcec8137eb908caa8f0ce"]
["colibrilib.0.4.0" "git+https://git.frama-c.com/pub/colibrics.git#1feba887bbb7980f27bbcec8137eb908caa8f0ce"]
["alt-ergo-lib.dev" "git+https://github.com/OCamlPro/alt-ergo.git#7ee96296a5de9588a4d585b3b8abec35f4755425"]
["alt-ergo-lib.2.6.0" "git+https://github.com/OCamlPro/alt-ergo.git#7ee96296a5de9588a4d585b3b8abec35f4755425"]
["cvc5.dev" "git+https://github.com/formalsec/ocaml-cvc5.git#b7aade52d49a19d646036d7e6aac09039c3e95cf"]
["benchpress.dev" "git+https://github.com/filipeom/benchpress.git#50355de32835b12f1b065a4700f493bc3d8c5342"]
]
3 changes: 2 additions & 1 deletion src/ast/expr.ml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ let rec ty (hte : t) : Ty.t =
ty1
| Triop (ty, _, _, _, _) -> ty
| Relop (ty, _, _, _) -> ty
| Cvtop (Ty_bitv n, (Zero_extend m | Sign_extend m), _) -> Ty_bitv (n + m)
| Cvtop (_, (Zero_extend m | Sign_extend m), hte) -> (
match ty hte with Ty_bitv n -> Ty_bitv (n + m) | _ -> assert false )
| Cvtop (ty, _, _) -> ty
| Naryop (ty, _, _) -> ty
| Extract (_, h, l) -> Ty_bitv ((h - l) * 8)
Expand Down
1 change: 1 addition & 0 deletions test/unit/dune
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
test_unop
test_binop
test_triop
test_ty
test_relop
test_cvtop
test_naryop
Expand Down
8 changes: 8 additions & 0 deletions test/unit/test_ty.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
open Smtml

let () =
let x = Expr.symbol (Symbol.make (Ty_bitv 32) "x") in
let x = Expr.extract x ~high:2 ~low:0 in
assert (Ty.equal (Expr.ty x) (Ty_bitv 16));
let x = Expr.cvtop (Ty_bitv 32) (Sign_extend 16) x in
assert (Ty.equal (Expr.ty x) (Ty_bitv 32))