Skip to content
Snippets Groups Projects
Commit 762ba955 authored by Virgile Prevosto's avatar Virgile Prevosto
Browse files

Fixes issues in updating labels and gotos during instrumentation

Label.move must compare goto targets to the statement in the original
AST, not its copy. Furthermore moving labels must only be done if we
are about to change the target of the gotos, not if we use the
statement as generated by the plain visitor.
parent 86c130f3
No related branches found
No related tags found
No related merge requests found
...@@ -44,6 +44,7 @@ let move (vis:Visitor.generic_frama_c_visitor) ~old new_stmt = ...@@ -44,6 +44,7 @@ let move (vis:Visitor.generic_frama_c_visitor) ~old new_stmt =
| _ :: _ -> | _ :: _ ->
old.labels <- []; old.labels <- [];
new_stmt.labels <- labels @ new_stmt.labels; new_stmt.labels <- labels @ new_stmt.labels;
let old = Cil.get_original_stmt vis#behavior old in
Labeled_stmts.add old new_stmt; Labeled_stmts.add old new_stmt;
(* update the gotos of the function jumping to one of the labels *) (* update the gotos of the function jumping to one of the labels *)
let o orig_stmt = object let o orig_stmt = object
......
...@@ -678,10 +678,12 @@ you must call function `%s' and `__e_acsl_memory_clean by yourself.@]" ...@@ -678,10 +678,12 @@ you must call function `%s' and `__e_acsl_memory_clean by yourself.@]"
b.bstmts <- List.rev l @ delete_stmts b.bstmts <- List.rev l @ delete_stmts
end; end;
let new_stmt = Misc.mk_block prj stmt b in let new_stmt = Misc.mk_block prj stmt b in
(* move the labels of the return to the new block in order to if not (Cil_datatype.Stmt.equal stmt new_stmt) then begin
evaluate the postcondition when jumping to them. *) (* move the labels of the return to the new block in order to
E_acsl_label.move evaluate the postcondition when jumping to them. *)
(self :> Visitor.generic_frama_c_visitor) stmt new_stmt; E_acsl_label.move
(self :> Visitor.generic_frama_c_visitor) stmt new_stmt
end;
new_stmt, env new_stmt, env
else else
stmt, env stmt, env
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment