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
38df9340
Commit
38df9340
authored
4 years ago
by
Loïc Correnson
Browse files
Options
Downloads
Patches
Plain Diff
[wp] stmt assertions
parent
a7f9cc56
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/plugins/wp/cfgCalculus.ml
+8
-6
8 additions, 6 deletions
src/plugins/wp/cfgCalculus.ml
src/plugins/wp/wpAnnot.ml
+37
-0
37 additions, 0 deletions
src/plugins/wp/wpAnnot.ml
src/plugins/wp/wpAnnot.mli
+11
-0
11 additions, 0 deletions
src/plugins/wp/wpAnnot.mli
with
56 additions
and
6 deletions
src/plugins/wp/cfgCalculus.ml
+
8
−
6
View file @
38df9340
...
@@ -103,19 +103,21 @@ struct
...
@@ -103,19 +103,21 @@ struct
try
try
env
.
ki
<-
Kstmt
s
;
env
.
ki
<-
Kstmt
s
;
Cil
.
CurrentLoc
.
set
(
Stmt
.
loc
s
)
;
Cil
.
CurrentLoc
.
set
(
Stmt
.
loc
s
)
;
let
pi
=
M
.
label
env
.
we
(
Some
s
)
(
Clabels
.
stmt
s
)
(
asserts
env
a
s
)
in
let
ca
=
WpAnnot
.
get_code_assertions
env
.
kf
s
in
let
pi
=
M
.
label
env
.
we
(
Some
s
)
(
Clabels
.
stmt
s
)
@@
List
.
fold_right
(
M
.
add_goal
env
.
we
)
ca
.
code_verified
@@
List
.
fold_right
(
M
.
add_hyp
env
.
we
)
ca
.
code_admitted
@@
control
env
a
s
in
Cil
.
CurrentLoc
.
set
kl
;
Cil
.
CurrentLoc
.
set
kl
;
env
.
ki
<-
ki
;
pi
env
.
ki
<-
ki
;
pi
with
err
->
with
err
->
Cil
.
CurrentLoc
.
set
kl
;
Cil
.
CurrentLoc
.
set
kl
;
env
.
ki
<-
ki
;
raise
err
env
.
ki
<-
ki
;
raise
err
(* Consider assertions *)
and
asserts
env
a
(
s
:
stmt
)
:
M
.
t_prop
=
(*TODO: apply code annots *)
control
env
a
s
(* Branching wrt control-flow *)
(* Branching wrt control-flow *)
and
control
env
a
(
s
:
stmt
)
:
M
.
t_prop
=
and
control
env
a
s
:
M
.
t_prop
=
match
s
.
skind
with
match
s
.
skind
with
|
Loop
(
_
,_,_,_,_
)
->
|
Loop
(
_
,_,_,_,_
)
->
loop
env
a
s
(
WpAnnot
.
get_loop_contract
env
.
kf
s
)
loop
env
a
s
(
WpAnnot
.
get_loop_contract
env
.
kf
s
)
...
...
This diff is collapsed.
Click to expand it.
src/plugins/wp/wpAnnot.ml
+
37
−
0
View file @
38df9340
...
@@ -188,6 +188,43 @@ let preconditions_at_call s = function
...
@@ -188,6 +188,43 @@ let preconditions_at_call s = function
let
get_called_preconditions_at
kf
stmt
=
let
get_called_preconditions_at
kf
stmt
=
List
.
map
snd
(
call_preconditions
kf
stmt
)
List
.
map
snd
(
call_preconditions
kf
stmt
)
(* -------------------------------------------------------------------------- *)
(* --- Code Assertions --- *)
(* -------------------------------------------------------------------------- *)
type
code_assertions
=
{
code_admitted
:
WpPropId
.
pred_info
list
;
code_verified
:
WpPropId
.
pred_info
list
;
}
let
reverse_code_assertions
a
=
{
code_admitted
=
List
.
rev
a
.
code_admitted
;
code_verified
=
List
.
rev
a
.
code_verified
;
}
let
get_code_assertions
kf
stmt
:
code_assertions
=
let
labels
=
NormAtLabels
.
labels_assert_before
~
kf
stmt
in
let
normalize_pred
p
=
NormAtLabels
.
preproc_annot
labels
p
in
reverse_code_assertions
@@
Annotations
.
fold_code_annot
begin
fun
_emitter
ca
l
->
match
ca
.
annot_content
with
|
AAssert
(
_
,
a
)
->
let
p
=
WpPropId
.
mk_assert_id
kf
stmt
ca
,
normalize_pred
a
.
tp_statement
in
if
a
.
tp_only_check
then
{
l
with
code_admitted
=
p
::
l
.
code_admitted
;
}
else
{
code_admitted
=
p
::
l
.
code_admitted
;
code_verified
=
p
::
l
.
code_verified
;
}
|
_
->
l
end
stmt
{
code_admitted
=
[]
;
code_verified
=
[]
;
}
(* -------------------------------------------------------------------------- *)
(* -------------------------------------------------------------------------- *)
(* --- Loop Invariants --- *)
(* --- Loop Invariants --- *)
(* -------------------------------------------------------------------------- *)
(* -------------------------------------------------------------------------- *)
...
...
This diff is collapsed.
Click to expand it.
src/plugins/wp/wpAnnot.mli
+
11
−
0
View file @
38df9340
...
@@ -63,6 +63,17 @@ val get_called_post_conditions : kernel_function -> Property.t list
...
@@ -63,6 +63,17 @@ val get_called_post_conditions : kernel_function -> Property.t list
val
get_called_exit_conditions
:
kernel_function
->
Property
.
t
list
val
get_called_exit_conditions
:
kernel_function
->
Property
.
t
list
val
get_called_assigns
:
kernel_function
->
Property
.
t
list
val
get_called_assigns
:
kernel_function
->
Property
.
t
list
(* -------------------------------------------------------------------------- *)
(* --- Property Accessors : Assertions --- *)
(* -------------------------------------------------------------------------- *)
type
code_assertions
=
{
code_admitted
:
WpPropId
.
pred_info
list
;
code_verified
:
WpPropId
.
pred_info
list
;
}
val
get_code_assertions
:
kernel_function
->
stmt
->
code_assertions
(* -------------------------------------------------------------------------- *)
(* -------------------------------------------------------------------------- *)
(* --- Property Accessors : Loop Contracts --- *)
(* --- Property Accessors : Loop Contracts --- *)
(* -------------------------------------------------------------------------- *)
(* -------------------------------------------------------------------------- *)
...
...
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