Skip to content

Commit 92fc5dd

Browse files
author
Philip Feniuk
committed
Merge remote-tracking branch 'upstream/master'
2 parents 4112c13 + 44ba988 commit 92fc5dd

File tree

11 files changed

+99
-7
lines changed

11 files changed

+99
-7
lines changed

goblint.opam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ dev-repo: "git+https://github.com/goblint/analyzer.git"
102102
available: os-family != "bsd" & os-distribution != "alpine" & (arch != "arm64" | os = "macos")
103103
pin-depends: [
104104
# published goblint-cil 2.0.6 is currently up-to-date, but pinned for reproducibility
105-
[ "goblint-cil.2.0.6" "git+https://github.com/goblint/cil.git#c0b10d1848223a67de45ef608f4e05c082977ac1" ]
105+
[ "goblint-cil.2.0.6" "git+https://github.com/goblint/cil.git#4b8b06eb39801a87d195f81d830a686578bd8b8b" ]
106106
# pinned for stability (https://github.com/goblint/analyzer/issues/1520), remove after new apron release
107107
[ "apron.v0.9.15" "git+https://github.com/antoinemine/apron.git#418a217c7a70dae3f422678f3aaba38ae374d91a" ]
108108
]

goblint.opam.locked

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ post-messages: [
143143
pin-depends: [
144144
[
145145
"goblint-cil.2.0.6"
146-
"git+https://github.com/goblint/cil.git#c0b10d1848223a67de45ef608f4e05c082977ac1"
146+
"git+https://github.com/goblint/cil.git#4b8b06eb39801a87d195f81d830a686578bd8b8b"
147147
]
148148
[
149149
"apron.v0.9.15"

goblint.opam.template

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
# also remember to generate/adjust goblint.opam.locked!
33
available: os-family != "bsd" & os-distribution != "alpine" & (arch != "arm64" | os = "macos")
44
pin-depends: [
5-
# published goblint-cil 2.0.6 is currently up-to-date, but pinned for reproducibility
6-
[ "goblint-cil.2.0.6" "git+https://github.com/goblint/cil.git#c0b10d1848223a67de45ef608f4e05c082977ac1" ]
5+
[ "goblint-cil.2.0.6" "git+https://github.com/goblint/cil.git#4b8b06eb39801a87d195f81d830a686578bd8b8b" ]
76
# pinned for stability (https://github.com/goblint/analyzer/issues/1520), remove after new apron release
87
[ "apron.v0.9.15" "git+https://github.com/antoinemine/apron.git#418a217c7a70dae3f422678f3aaba38ae374d91a" ]
98
]

src/analyses/base.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ struct
3838
type t = Dom.t
3939
module D = Dom
4040
include Analyses.ValueContexts(D)
41+
module P = IdentityP(Dom)
4142

4243
(* Two global invariants:
4344
1. Priv.V -> Priv.G -- used for Priv

src/analyses/branchSet.ml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
(** Helper analysis to be path-sensitive in set of taken branches. *)
2+
3+
open GoblintCil
4+
open Analyses
5+
6+
module Spec =
7+
struct
8+
include Analyses.IdentitySpec
9+
10+
module Branch = Printable.ProdSimple(BoolDomain.Bool)(Node)
11+
module BranchSet = SetDomain.Make(Branch)
12+
13+
module D = BranchSet
14+
include Analyses.ValueContexts(D)
15+
module P = IdentityP (D)
16+
17+
18+
let enter man (lval: lval option) (f:fundec) (args:exp list) : (D.t * D.t) list =
19+
[man.local,man.local]
20+
21+
let combine_env man lval fexp f args fc au f_ask =
22+
au
23+
24+
let combine_assign man (lval:lval option) fexp (f:fundec) (args:exp list) fc (au:D.t) (f_ask: Queries.ask) : D.t =
25+
man.local
26+
27+
28+
let branch man (exp:exp) (tv:bool) : D.t =
29+
BranchSet.add (tv, man.node) man.local
30+
31+
32+
let name () = "branchSet"
33+
34+
let startstate v = D.empty ()
35+
let threadenter man ~multiple lval f args = [D.empty ()]
36+
let exitstate v = D.empty ()
37+
end
38+
39+
let _ =
40+
MCP.register_analysis (module Spec : MCPSpec)

src/config/options.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@
352352
"description": "List of path-sensitive analyses",
353353
"type": "array",
354354
"items": { "type": "string" },
355-
"default": [ "mutex", "malloc_null", "uninit", "expsplit","activeSetjmp","memLeak" ]
355+
"default": [ "mutex", "malloc_null", "uninit", "expsplit", "activeSetjmp", "memLeak", "branchSet"]
356356
},
357357
"ctx_insens": {
358358
"title": "ana.ctx_insens",

src/framework/analyses.ml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,12 @@ struct
322322
let should_print _ = false
323323
end
324324

325+
module EmptyP =
326+
struct
327+
include Printable.Empty
328+
let of_elt _ = failwith "EmptyP.of_elt: analysis cannot be path-sensitive"
329+
end
330+
325331
module UnitP =
326332
struct
327333
include Printable.Unit
@@ -339,7 +345,7 @@ module DefaultSpec =
339345
struct
340346
module G = Lattice.Unit
341347
module V = EmptyV
342-
module P = UnitP
348+
module P = EmptyP
343349

344350
type marshal = unit
345351
let init _ = ()

src/goblint_lib.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ module Callstring = Callstring
160160
module LoopfreeCallstring = LoopfreeCallstring
161161
module Uninit = Uninit
162162
module Expsplit = Expsplit
163+
module BranchSet = BranchSet
163164
module StackTrace = StackTrace
164165

165166
(** {2 Helper}

src/solver/sideWPointSelect.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module type S =
2020
*)
2121
val create_data: (S.v -> bool) -> (S.v -> S.v -> unit) -> data
2222

23-
(** Notifies this strategy that a side-effect has occured.
23+
(** Notifies this strategy that a side-effect has occurred.
2424
This allows the strategy to adapt its internal data structure.
2525
@param data The internal state of this strategy
2626
@param x The optional source of the side-effect

tests/regression/01-cpa/80-path.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//PARAM: --enable ana.int.interval --set ana.path_sens[+] base
2+
#include <stdio.h>
3+
#include <stdlib.h>
4+
#include <goblint.h>
5+
6+
int main () {
7+
int a;
8+
int b;
9+
10+
int top;
11+
12+
if(top) {
13+
a = 5; b = 5;
14+
} else {
15+
a = 10; b = 10;
16+
}
17+
18+
__goblint_check(a == b);
19+
return 0;
20+
}

0 commit comments

Comments
 (0)