Skip to content

Commit

Permalink
Refactor Access.may_race with match
Browse files Browse the repository at this point in the history
  • Loading branch information
sim642 committed Nov 2, 2023
1 parent 417d5d3 commit c42ec6b
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/domains/access.ml
Original file line number Diff line number Diff line change
Expand Up @@ -438,16 +438,13 @@ struct
end


(* Check if two accesses may race and if yes with which confidence *)
(** Check if two accesses may race. *)
let may_race A.{kind; acc; _} A.{kind=kind2; acc=acc2; _} =
if kind = Read && kind2 = Read then
false (* two read/read accesses do not race *)
else if not (get_bool "ana.race.free") && (kind = Free || kind2 = Free) then
false
else if not (MCPAccess.A.may_race acc acc2) then
false (* analysis-specific information excludes race *)
else
true
match kind, kind2 with
| Read, Read -> false (* two read/read accesses do not race *)
| Free, _
| _, Free when not (get_bool "ana.race.free") -> false
| _, _ -> MCPAccess.A.may_race acc acc2 (* analysis-specific information excludes race *)

(** Access sets for race detection and warnings. *)
module WarnAccs =
Expand Down

0 comments on commit c42ec6b

Please sign in to comment.