Skip to content
Snippets Groups Projects
Commit e762f5a6 authored by Basile Desloges's avatar Basile Desloges
Browse files

[eacsl] Remove hypotheses when reemitting invalid properties during AST preparation

parent c77f1655
No related branches found
No related tags found
No related merge requests found
...@@ -203,7 +203,34 @@ let dup_global loc spec sound_verdict_vi kf vi new_vi = ...@@ -203,7 +203,34 @@ let dup_global loc spec sound_verdict_vi kf vi new_vi =
let e = Emitter.Usable_emitter.get ep.emitter in let e = Emitter.Usable_emitter.get ep.emitter in
if ep.logical_consequence if ep.logical_consequence
then logical_consequence e new_ip ep.properties then logical_consequence e new_ip ep.properties
else emit e new_ip ~hyps:ep.properties status else
let status, hyps =
match status, ep.properties with
| True, _ | Dont_know, _
| False_and_reachable, [] | False_if_reachable, [] ->
(* Valid emission: either [true] status with arbitrary hypotheses or
[false] status with empty hypotheses. *)
status, ep.properties
| False_and_reachable, [ IPReachable _ ]
| False_if_reachable, [ IPReachable _ ] ->
(* [False] status with a reachability hypothesis: remove the
hypothesis and set the status to [False_if_reachable]. *)
False_if_reachable, []
| False_and_reachable, hyps | False_if_reachable, hyps ->
(* Invalid emission: [false] status with arbitrary hypotheses. *)
Options.fatal
"Property with status '%s' and non-empty hypotheses:\n\
* Property: %a\n\
* Hypotheses:\n- %a"
(match status with
| True -> "True"
| Dont_know -> "Dont_know"
| False_if_reachable -> "False_if_reachable"
| False_and_reachable -> "False_and_reachable")
Property.short_pretty new_ip
(Pretty_utils.pp_list ~sep:"\n- " Property.short_pretty) hyps
in
emit e new_ip ~hyps status
in in
match get old_ip with match get old_ip with
| Never_tried -> | Never_tried ->
...@@ -212,9 +239,9 @@ let dup_global loc spec sound_verdict_vi kf vi new_vi = ...@@ -212,9 +239,9 @@ let dup_global loc spec sound_verdict_vi kf vi new_vi =
List.iter (cp s) epl List.iter (cp s) epl
| Inconsistent icst -> | Inconsistent icst ->
List.iter (cp True) icst.valid; List.iter (cp True) icst.valid;
(* either the program is reachable and [False_and_reachable] is (* Copy invalid properties with [False_and_reachable], if a reachability
fine, or the program point is not reachable and it does not hypothesis is present then the [cp] function will convert it to
matter for E-ACSL that checks it at runtime. *) [False_if_reachable]. *)
List.iter (cp False_and_reachable) icst.invalid List.iter (cp False_and_reachable) icst.invalid
in in
let ips kf s = Property.ip_of_spec kf Kglobal ~active:[] s in let ips kf s = Property.ip_of_spec kf Kglobal ~active:[] s in
......
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