Skip to content
Snippets Groups Projects
Commit 93493dc2 authored by David Bühler's avatar David Bühler
Browse files

[Eva] Fixes a crash on recursive functions with a specification but no assigns.

parent 161b7ee4
No related branches found
No related tags found
No related merge requests found
...@@ -44,6 +44,11 @@ let mark_unknown_requires kinstr kf funspec = ...@@ -44,6 +44,11 @@ let mark_unknown_requires kinstr kf funspec =
in in
List.iter emit_behavior funspec.spec_behavior List.iter emit_behavior funspec.spec_behavior
let need_assigns funspec =
match Cil.find_default_behavior funspec with
| None -> true
| Some bhv -> bhv.b_assigns = WritesAny
let get_spec kinstr kf = let get_spec kinstr kf =
let funspec = Annotations.funspec ~populate:false kf in let funspec = Annotations.funspec ~populate:false kf in
if List.for_all (fun b -> b.b_assigns = WritesAny) funspec.spec_behavior if List.for_all (fun b -> b.b_assigns = WritesAny) funspec.spec_behavior
...@@ -75,6 +80,15 @@ let get_spec kinstr kf = ...@@ -75,6 +80,15 @@ let get_spec kinstr kf =
(if depth > 0 then Format.asprintf " of depth %i" depth else "") (if depth > 0 then Format.asprintf " of depth %i" depth else "")
Kernel_function.pretty kf Kernel_function.pretty kf
in in
let funspec =
if need_assigns funspec
then
begin
ignore (!Annotations.populate_spec_ref kf funspec);
Annotations.funspec ~populate:false kf
end
else funspec
in
mark_unknown_requires kinstr kf funspec; mark_unknown_requires kinstr kf funspec;
funspec funspec
......
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