Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
7449e029
Commit
7449e029
authored
4 years ago
by
Loïc Correnson
Browse files
Options
Downloads
Patches
Plain Diff
[wp] compute static calls
parent
97de98ae
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/plugins/wp/cfgCalculus.ml
+26
-1
26 additions, 1 deletion
src/plugins/wp/cfgCalculus.ml
src/plugins/wp/wpAnnot.ml
+23
-0
23 additions, 0 deletions
src/plugins/wp/wpAnnot.ml
src/plugins/wp/wpAnnot.mli
+5
-4
5 additions, 4 deletions
src/plugins/wp/wpAnnot.mli
with
54 additions
and
5 deletions
src/plugins/wp/cfgCalculus.ml
+
26
−
1
View file @
7449e029
...
...
@@ -262,7 +262,32 @@ struct
Varinfo
.
pretty
x
;
p
|
Asm
_
->
M
.
use_assigns
env
.
we
None
(
WpPropId
.
mk_asm_assigns_desc
s
)
p
|
Call
_
->
assert
false
|
Call
(
r
,
fct
,
es
,_
)
->
begin
match
Kernel_function
.
get_called
fct
with
|
Some
kf
->
call
env
s
r
kf
es
(
WpAnnot
.
get_call_contract
kf
)
p
|
None
->
(*TODO: dynamic call *)
assert
false
end
and
call
env
s
r
kf
es
(
c
:
WpAnnot
.
call_contract
)
wr
:
M
.
t_prop
=
let
filter
ps
=
List
.
filter
(
is_selected
env
~
goal
:
false
)
ps
in
let
w_call
=
M
.
call
env
.
we
s
r
kf
es
~
pre
:
(
filter
c
.
call_pre
)
~
post
:
(
filter
c
.
call_post
)
~
pexit
:
(
filter
c
.
call_exit
)
~
assigns
:
c
.
call_assigns
~
p_post
:
wr
~
p_exit
:
env
.
wk
in
if
is_default_bhv
env
.
mode
then
let
pre
=
List
.
filter_map
(
fun
p
->
if
is_selected
env
~
goal
:
true
p
then
Some
(
WpAnnot
.
get_precond_at
kf
s
p
)
else
None
)
c
.
call_pre
in
M
.
call_goal_precond
env
.
we
s
kf
es
~
pre
w_call
else
w_call
let
body
env
~
ensures
~
exits
w
=
let
rw
=
List
.
fold_right
(
prove_property
env
)
ensures
w
in
...
...
This diff is collapsed.
Click to expand it.
src/plugins/wp/wpAnnot.ml
+
23
−
0
View file @
7449e029
...
...
@@ -236,6 +236,22 @@ let get_behavior kf ki ~active bhv =
(* --- Called Contract --- *)
(* -------------------------------------------------------------------------- *)
(*TODO: put it in Status_by_call ? *)
module
AllPrecondStatus
=
State_builder
.
Hashtbl
(
Kernel_function
.
Hashtbl
)(
Datatype
.
Unit
)
(
struct
let
name
=
"Call Preconditions Proxy Generated"
let
dependencies
=
[
Ast
.
self
]
let
size
=
32
end
)
let
setup_preconditions
kf
=
if
not
(
AllPrecondStatus
.
mem
kf
)
then
begin
AllPrecondStatus
.
add
kf
()
;
Statuses_by_call
.
setup_all_preconditions_proxies
kf
;
end
type
call_contract
=
{
call_pre
:
WpPropId
.
pred_info
list
;
call_post
:
WpPropId
.
pred_info
list
;
...
...
@@ -243,12 +259,19 @@ type call_contract = {
call_assigns
:
Cil_types
.
assigns
;
}
let
get_precond_at
kf
stmt
(
id
,
p
)
=
let
pi
=
WpPropId
.
property_of_id
id
in
let
pi_at
=
Statuses_by_call
.
precondition_at_call
kf
pi
stmt
in
let
id_at
=
WpPropId
.
mk_call_pre_id
kf
stmt
pi
pi_at
in
id_at
,
p
let
get_call_contract
kf
=
let
cpre
:
WpPropId
.
pred_info
list
ref
=
ref
[]
in
let
cpost
:
WpPropId
.
pred_info
list
ref
=
ref
[]
in
let
cexit
:
WpPropId
.
pred_info
list
ref
=
ref
[]
in
let
cwrites
=
ref
[]
in
let
add
c
f
x
=
c
:=
(
f
x
)
::
!
c
in
setup_preconditions
kf
;
List
.
iter
begin
fun
bhv
->
let
assumes
=
...
...
This diff is collapsed.
Click to expand it.
src/plugins/wp/wpAnnot.mli
+
5
−
4
View file @
7449e029
...
...
@@ -104,12 +104,13 @@ val get_loop_contract : kernel_function -> stmt -> loop_contract
(* -------------------------------------------------------------------------- *)
type
call_contract
=
{
call_pre
:
WpPropId
.
pred_info
list
;
call_post
:
WpPropId
.
pred_info
list
;
call_exit
:
WpPropId
.
pred_info
list
;
call_assigns
:
Cil_types
.
assigns
;
call_pre
:
pred_info
list
;
call_post
:
pred_info
list
;
call_exit
:
pred_info
list
;
call_assigns
:
assigns
;
}
val
get_precond_at
:
kernel_function
->
stmt
->
pred_info
->
pred_info
val
get_call_contract
:
kernel_function
->
call_contract
(* -------------------------------------------------------------------------- *)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment