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

PrivPrecCompare: Add bot_in_blob_leq_bot so bot and Blob(bot) are considered equal #1645

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
8 changes: 7 additions & 1 deletion src/cdomain/value/cdomains/valueDomain.ml
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,13 @@ struct
| (_, Top) -> true
| (Top, _) -> false
| (Bot, _) -> true
| (_, Bot) -> false
| (x, Bot) ->
if !AnalysisState.bot_in_blob_leq_bot then
match x with
| Blob (x,s,o) -> leq x Bot
| _ -> false
else
false
| (Int x, Int y) -> ID.leq x y
| (Float x, Float y) -> FD.leq x y
| (Int x, Address y) when ID.to_int x = Some Z.zero && not (AD.is_not_null y) -> true
Expand Down
5 changes: 4 additions & 1 deletion src/common/framework/analysisState.ml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,7 @@ let verified : bool option ref = ref None
let unsound_both_branches_dead: bool option ref = ref None
(** [Some true] if unsound both branches dead occurs in analysis results.
[Some false] if it doesn't occur.
[None] if [ana.dead-code.branches] option is disabled and this isn't checked. *)
[None] if [ana.dead-code.branches] option is disabled and this isn't checked. *)

(* Comparison mode where blobs with bot content that are not zero-initalized are considered equivalent to top-level bot *)
let bot_in_blob_leq_bot = ref false
1 change: 1 addition & 0 deletions src/privPrecCompare.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ open Goblint_lib
module A = PrecCompare.MakeDump (PrivPrecCompareUtil)

let () =
AnalysisState.bot_in_blob_leq_bot := true;
A.main ()
Loading