Skip to content

Commit

Permalink
checksafety: reset A/M-var conversion table
Browse files Browse the repository at this point in the history
  • Loading branch information
vbgl authored and Jean-Christophe Léchenet committed Jan 10, 2023
1 parent 97cb1e0 commit ccc9b66
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
([PR #313](https://github.com/jasmin-lang/jasmin/pull/313);
fixes [#310](https://github.com/jasmin-lang/jasmin/issues/310)).

- Fix to the safety checker
([PR #315](https://github.com/jasmin-lang/jasmin/pull/315);
fixes [#314](https://github.com/jasmin-lang/jasmin/issues/314)).

## Other changes

- Explicit if-then-else in flag combinations is no longer supported
Expand Down
15 changes: 15 additions & 0 deletions compiler/safety/success/bug_314.jazz
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
inline fn f(reg u32 i) {
reg bool zf;
while {
_,_,_,zf,i = #DEC_32(i);
} (!zf)
}

inline fn g() {
reg u32 i;
i = 42;
f(2);
}

export fn test1() { g(); }
export fn test2() { g(); }
2 changes: 2 additions & 0 deletions compiler/src/safety/domains/safetyNum.ml
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ module AbsNumI (Manager : AprManager) (PW : ProgWrap) : AbsNumType = struct
type t = Manager.t Abstract1.t
let man = Manager.man

let () = SafetyVar.reset ()

let is_relational () = Ppl.manager_is_ppl man

let make l =
Expand Down
1 change: 1 addition & 0 deletions compiler/src/safety/safetyVar.ml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ let get_at = function
(*---------------------------------------------------------------*)
(* We log the result to be able to inverse it. *)
let log_var = Hashtbl.create 16
let reset () = Hashtbl.reset log_var

let avar_of_mvar a =
let s = string_of_mvar a in
Expand Down
5 changes: 5 additions & 0 deletions compiler/src/safety/safetyVar.mli
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ val of_scope : Expr.v_scope -> atype -> mvar
val get_scope : mvar -> Expr.v_scope
val get_at : mvar -> atype

(*---------------------------------------------------------------*)
(** Resets the conversion table between [mvar] and [avar]. To
be called between two analyses. *)
val reset : unit -> unit

(*---------------------------------------------------------------*)
val avar_of_mvar : mvar -> Apron.Var.t

Expand Down

0 comments on commit ccc9b66

Please sign in to comment.