Skip to content

Commit 746d436

Browse files
Merge pull request #1645 from goblint/bot_in_blob_leq_bot
PrivPrecCompare: Add `bot_in_blob_leq_bot` so `bot` and `Blob(bot)` are considered equal
2 parents 99df9da + 254a21f commit 746d436

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/cdomain/value/cdomains/valueDomain.ml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,13 @@ struct
561561
| (_, Top) -> true
562562
| (Top, _) -> false
563563
| (Bot, _) -> true
564-
| (_, Bot) -> false
564+
| (x, Bot) ->
565+
if !AnalysisState.bot_in_blob_leq_bot then
566+
match x with
567+
| Blob (x,s,o) -> leq x Bot
568+
| _ -> false
569+
else
570+
false
565571
| (Int x, Int y) -> ID.leq x y
566572
| (Float x, Float y) -> FD.leq x y
567573
| (Int x, Address y) when ID.to_int x = Some Z.zero && not (AD.is_not_null y) -> true

src/common/framework/analysisState.ml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,7 @@ let verified : bool option ref = ref None
4040
let unsound_both_branches_dead: bool option ref = ref None
4141
(** [Some true] if unsound both branches dead occurs in analysis results.
4242
[Some false] if it doesn't occur.
43-
[None] if [ana.dead-code.branches] option is disabled and this isn't checked. *)
43+
[None] if [ana.dead-code.branches] option is disabled and this isn't checked. *)
44+
45+
(* Comparison mode where blobs with bot content that are not zero-initalized are considered equivalent to top-level bot *)
46+
let bot_in_blob_leq_bot = ref false

src/privPrecCompare.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ open Goblint_lib
44
module A = PrecCompare.MakeDump (PrivPrecCompareUtil)
55

66
let () =
7+
AnalysisState.bot_in_blob_leq_bot := true;
78
A.main ()

0 commit comments

Comments
 (0)