Skip to content

Commit 11e6e19

Browse files
committed
CHC:add proof obligations to calls
1 parent 36494d8 commit 11e6e19

File tree

1 file changed

+33
-27
lines changed

1 file changed

+33
-27
lines changed

CodeHawk/CHC/cchpre/cCHCreateOutputParameterPOs.ml

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,35 @@ object (self)
139139
(context: program_context_int) (e: exp) (loc: location) =
140140
self#create_po_exp context#add_goto e loc
141141

142+
method private create_output_parameter_po_s
143+
(context: program_context_int)
144+
(loc: location) =
145+
(List.iter (fun vinfo ->
146+
let vty = fenv#get_type_unrolled vinfo.vtype in
147+
(match vty with
148+
| TPtr (ty, _) ->
149+
if is_integral_type ty then
150+
begin
151+
self#add_ppo
152+
(POutputParameterInitialized (vinfo, NoOffset))
153+
loc context;
154+
self#add_ppo
155+
(POutputParameterUnaltered (vinfo, NoOffset))
156+
loc context
157+
end
158+
else if is_scalar_struct_type ty then
159+
let offsets = get_scalar_struct_offsets ty in
160+
List.iter (fun offset ->
161+
begin
162+
self#add_ppo
163+
(POutputParameterInitialized (vinfo, offset))
164+
loc context;
165+
self#add_ppo
166+
(POutputParameterUnaltered (vinfo, offset))
167+
loc context
168+
end) offsets
169+
| _ -> ())) self#pointer_parameters)
170+
142171
method private create_po_return
143172
(context: program_context_int) (e:exp option) (loc: location) =
144173
let _ = self#spomanager#add_return loc context#add_return e in
@@ -148,35 +177,11 @@ object (self)
148177
begin
149178
self#create_po_exp context#add_return x loc;
150179
(match type_of_exp self#env x with
151-
| TPtr _ -> self#add_ppo (PValidMem x) loc context
180+
| TPtr _ -> self#add_ppo (PValidMem x) loc context#add_return
152181
| _ -> ())
153182
end
154183
| _ -> ());
155-
(List.iter (fun vinfo ->
156-
let vty = fenv#get_type_unrolled vinfo.vtype in
157-
(match vty with
158-
| TPtr (ty, _) ->
159-
if is_integral_type ty then
160-
begin
161-
self#add_ppo
162-
(POutputParameterInitialized (vinfo, NoOffset))
163-
loc context#add_return;
164-
self#add_ppo
165-
(POutputParameterUnaltered (vinfo, NoOffset))
166-
loc context#add_return
167-
end
168-
else if is_scalar_struct_type ty then
169-
let offsets = get_scalar_struct_offsets ty in
170-
List.iter (fun offset ->
171-
begin
172-
self#add_ppo
173-
(POutputParameterInitialized (vinfo, offset))
174-
loc context#add_return;
175-
self#add_ppo
176-
(POutputParameterUnaltered (vinfo, offset))
177-
loc context#add_return
178-
end) offsets
179-
| _ -> ())) self#pointer_parameters)
184+
self#create_output_parameter_po_s context#add_return loc
180185
end
181186

182187
method private create_po_instr (context: program_context_int) (i: instr) =
@@ -222,7 +227,8 @@ object (self)
222227
(match fenv#get_type_unrolled (type_of_exp self#env x) with
223228
| TPtr _ -> self#add_ppo (PValidMem x) loc newcontext
224229
| _ -> ())
225-
end) el)
230+
end) el);
231+
self#create_output_parameter_po_s context loc
226232
end
227233

228234
method private create_po_exp

0 commit comments

Comments
 (0)