Skip to content

Commit 5793efd

Browse files
committed
CHC: add check on returnsites written
1 parent 959f36a commit 5793efd

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

CodeHawk/CHC/cchpre/cCHCandidateOutputParameter.ml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,22 @@ object (self)
235235
| POutputParameterUnaltered _ ->
236236
let ictxt = ccontexts#index_context po#get_context in
237237
if H.mem returnsites ictxt then
238-
(H.find returnsites ictxt)#record_proof_obligation_result po
238+
begin
239+
(H.find returnsites ictxt)#record_proof_obligation_result po;
240+
self#check_returnsites
241+
end
239242
| POutputParameterNoEscape (_vinfo, e) ->
240243
if po#is_violation then
241244
self#reject (OpOtherReason ("parameter escapes with argument " ^ (e2s e)))
242245
| _ -> ()
243246

247+
method private check_returnsites =
248+
let returnsites = H.fold (fun _ v a -> v :: a) returnsites [] in
249+
if List.for_all (fun r ->
250+
match r#status with OpUnaltered -> true | _ -> false) returnsites then
251+
self#reject (OpOtherReason ("parameter is not written by any return site"))
252+
else
253+
()
244254

245255
method is_active (_po_s: proof_obligation_int list) =
246256
match status with

0 commit comments

Comments
 (0)