Skip to content

Commit 9c77c8d

Browse files
committed
Fix Vojdani privatization protected variables in witnesses (closes #1713)
1 parent dbf1f7d commit 9c77c8d

File tree

4 files changed

+8
-26
lines changed

4 files changed

+8
-26
lines changed

src/analyses/apron/relationPriv.apron.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ struct
431431

432432
let iter_sys_vars getg vq vf = () (* TODO: or report singleton global for any Global query? *)
433433
let invariant_global ask getg g = Invariant.none
434-
let invariant_vars ask getg st = protected_vars ask (* TODO: is this right? *)
434+
let invariant_vars ask getg st = protected_vars ask ~kind:Write (* TODO: is this right? *)
435435

436436
let finalize () = ()
437437

src/analyses/basePriv.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ struct
357357
| `Thread ->
358358
st
359359

360-
let invariant_vars ask getg st = protected_vars ask
360+
let invariant_vars ask getg st = protected_vars ask ~kind:Write
361361
end
362362

363363
module PerMutexMeetPrivBase =
@@ -856,7 +856,7 @@ struct
856856
) locks inv
857857
)
858858

859-
let invariant_vars ask getg st = protected_vars ask
859+
let invariant_vars ask getg st = protected_vars ask ~kind:ReadWrite
860860
end
861861

862862

@@ -1102,7 +1102,7 @@ struct
11021102
) locks inv
11031103
)
11041104

1105-
let invariant_vars ask getg st = protected_vars ask
1105+
let invariant_vars ask getg st = protected_vars ask ~kind:Write
11061106
end
11071107

11081108
module AbstractLockCenteredGBase (WeakRange: Lattice.S) (SyncRange: Lattice.S) =

src/analyses/commonPriv.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ struct
101101
not (VD.is_immediate_type x.vtype) &&
102102
ask.f (Q.MustBeProtectedBy {mutex=m; global=x; kind; protection})
103103

104-
let protected_vars (ask: Q.ask): varinfo list =
104+
let protected_vars (ask: Q.ask) ~(kind): varinfo list =
105105
LockDomain.MustLockset.fold (fun ml acc ->
106-
Q.VS.join (ask.f (Q.MustProtectedVars {mutex = ml; kind = Write})) acc
106+
Q.VS.join (ask.f (Q.MustProtectedVars {mutex = ml; kind})) acc
107107
) (ask.f Q.MustLockset) (Q.VS.empty ())
108108
|> Q.VS.elements
109109
end

tests/regression/13-privatized/19-publish-precision.t

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ Vojdani does not succeed on check in t_fun.
150150
dead: 0
151151
total lines: 20
152152
[Info][Witness] witness generation summary:
153-
location invariants: 11
153+
location invariants: 9
154154
loop invariants: 0
155155
flow-insensitive invariants: 0
156156
total generation entries: 1
@@ -160,7 +160,7 @@ Vojdani does not succeed on check in t_fun.
160160
unsafe: 0
161161
total memory locations: 1
162162

163-
TODO: Vojdani should not have location_invariant-s on glob1 after locking mutex1 (line 11), only after mutex2.
163+
Vojdani should not have location_invariant-s on glob1 after locking mutex1 (line 11), only after mutex2.
164164

165165
$ yamlWitnessStrip < witness.yml
166166
- entry_type: invariant_set
@@ -174,24 +174,6 @@ TODO: Vojdani should not have location_invariant-s on glob1 after locking mutex1
174174
function: t_fun
175175
value: (unsigned long )arg == 0UL
176176
format: c_expression
177-
- invariant:
178-
type: location_invariant
179-
location:
180-
file_name: 19-publish-precision.c
181-
line: 11
182-
column: 3
183-
function: t_fun
184-
value: 0 <= glob1
185-
format: c_expression
186-
- invariant:
187-
type: location_invariant
188-
location:
189-
file_name: 19-publish-precision.c
190-
line: 11
191-
column: 3
192-
function: t_fun
193-
value: glob1 <= 127
194-
format: c_expression
195177
- invariant:
196178
type: location_invariant
197179
location:

0 commit comments

Comments
 (0)