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
e52eea9f
Commit
e52eea9f
authored
5 years ago
by
Allan Blanchard
Browse files
Options
Downloads
Patches
Plain Diff
[wp] Assigned do not considers formal and globals
parent
bb481ec2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/wp/MemVar.ml
+40
-46
40 additions, 46 deletions
src/plugins/wp/MemVar.ml
with
40 additions
and
46 deletions
src/plugins/wp/MemVar.ml
+
40
−
46
View file @
e52eea9f
...
@@ -736,26 +736,18 @@ struct
...
@@ -736,26 +736,18 @@ struct
Set
(
v2
,
update
v1
ofs
v
)
Set
(
v2
,
update
v1
ofs
v
)
|
_
->
failwith
"MemVar stored on a non MemVar location"
|
_
->
failwith
"MemVar stored on a non MemVar location"
let
memvar_set_init
seq
l
v
=
let
memvar_set_init
seq
x
ofs
v
=
match
l
with
if
x
.
vformal
||
x
.
vglob
then
[]
|
Ref
x
->
noref
~
op
:
"write to"
x
else
|
Val
((
CREF
|
CVAL
)
,
x
,
ofs
)
->
let
v1
=
get_init_term
seq
.
pre
x
in
let
v1
=
get_init_term
seq
.
pre
x
in
let
v2
=
get_init_term
seq
.
post
x
in
let
v2
=
get_init_term
seq
.
post
x
in
[
Set
(
v2
,
update_init
v1
ofs
v
)
]
Set
(
v2
,
update_init
v1
ofs
v
)
|
_
->
failwith
"MemVar initialize on a non MemVar location"
let
stored
seq
obj
l
v
=
match
l
with
let
stored
seq
obj
l
v
=
match
l
with
|
Ref
x
->
noref
~
op
:
"write to"
x
|
Ref
x
->
noref
~
op
:
"write to"
x
|
Val
((
CREF
|
CVAL
)
,
x
,_
)
->
|
Val
((
CREF
|
CVAL
)
,
x
,
ofs
)
->
let
init
=
let
init
=
Cvalues
.
initialized_obj
obj
in
if
not
(
x
.
vformal
||
x
.
vglob
)
then
(
memvar_stored
seq
obj
l
v
)
::
(
memvar_set_init
seq
x
ofs
init
)
[
memvar_set_init
seq
l
(
Cvalues
.
initialized_obj
obj
)
]
else
[]
in
(
memvar_stored
seq
obj
l
v
)
::
init
|
Val
((
CTXT
|
CARR
|
HEAP
)
as
m
,
x
,
ofs
)
->
|
Val
((
CTXT
|
CARR
|
HEAP
)
as
m
,
x
,
ofs
)
->
M
.
stored
(
mseq_of_seq
seq
)
obj
(
mloc_of_path
m
x
ofs
)
v
M
.
stored
(
mseq_of_seq
seq
)
obj
(
mloc_of_path
m
x
ofs
)
v
|
Loc
l
->
|
Loc
l
->
...
@@ -1259,40 +1251,42 @@ struct
...
@@ -1259,40 +1251,42 @@ struct
(* -------------------------------------------------------------------------- *)
(* -------------------------------------------------------------------------- *)
let
rec
monotonic_initialized
seq
obj
x
ofs
=
let
rec
monotonic_initialized
seq
obj
x
ofs
=
match
obj
with
if
x
.
vformal
||
x
.
vglob
then
p_true
|
C_int
_
|
C_float
_
|
C_pointer
_
->
else
p_imply
match
obj
with
(
p_bool
(
access_init
(
get_init_term
seq
.
pre
x
)
ofs
))
|
C_int
_
|
C_float
_
|
C_pointer
_
->
(
p_bool
(
access_init
(
get_init_term
seq
.
post
x
)
ofs
))
p_imply
|
C_array
{
arr_flat
=
flat
;
arr_element
=
t
}
->
(
p_bool
(
access_init
(
get_init_term
seq
.
pre
x
)
ofs
))
let
size
=
match
flat
with
(
p_bool
(
access_init
(
get_init_term
seq
.
post
x
)
ofs
))
|
None
->
unsized_array
()
|
C_array
{
arr_flat
=
flat
;
arr_element
=
t
}
->
|
Some
{
arr_size
}
->
arr_size
let
size
=
match
flat
with
in
|
None
->
unsized_array
()
let
low
=
(
e_int
0
)
in
|
Some
{
arr_size
}
->
arr_size
let
up
=
(
e_int
(
size
-
1
))
in
in
let
v
=
Lang
.
freshvar
~
basename
:
"i"
Lang
.
t_int
in
let
low
=
(
e_int
0
)
in
let
hyp
=
p_and
(
p_leq
low
(
e_var
v
))
(
p_leq
(
e_var
v
)
up
)
in
let
up
=
(
e_int
(
size
-
1
))
in
let
obj
=
Ctypes
.
object_of
t
in
let
v
=
Lang
.
freshvar
~
basename
:
"i"
Lang
.
t_int
in
let
ofs
=
ofs
@
[
Shift
(
obj
,
e_var
v
)
]
in
let
hyp
=
p_and
(
p_leq
low
(
e_var
v
))
(
p_leq
(
e_var
v
)
up
)
in
let
sub
=
monotonic_initialized
seq
obj
x
ofs
in
let
obj
=
Ctypes
.
object_of
t
in
Lang
.
F
.
p_forall
[
v
]
(
p_imply
hyp
sub
)
let
ofs
=
ofs
@
[
Shift
(
obj
,
e_var
v
)
]
in
|
C_comp
ci
->
let
sub
=
monotonic_initialized
seq
obj
x
ofs
in
let
mk_pred
f
=
Lang
.
F
.
p_forall
[
v
]
(
p_imply
hyp
sub
)
let
obj
=
Ctypes
.
object_of
f
.
ftype
in
|
C_comp
ci
->
let
ofs
=
ofs
@
[
Field
f
]
in
let
mk_pred
f
=
monotonic_initialized
seq
obj
x
ofs
let
obj
=
Ctypes
.
object_of
f
.
ftype
in
in
let
ofs
=
ofs
@
[
Field
f
]
in
Lang
.
F
.
p_conj
(
List
.
map
mk_pred
ci
.
cfields
)
monotonic_initialized
seq
obj
x
ofs
in
Lang
.
F
.
p_conj
(
List
.
map
mk_pred
ci
.
cfields
)
let
memvar_assigned
seq
obj
loc
v
=
let
memvar_assigned
seq
obj
loc
v
=
match
loc
with
match
loc
with
|
Ref
x
->
noref
~
op
:
"write to"
x
|
Ref
x
->
noref
~
op
:
"write to"
x
|
Val
((
CREF
|
CVAL
)
,
x
,
ofs
)
->
|
Val
((
CREF
|
CVAL
)
,
x
,
ofs
)
->
let
init
=
e_var
(
Lang
.
freshvar
~
basename
:
"v"
(
init_of_object
obj
))
in
let
init
=
e_var
(
Lang
.
freshvar
~
basename
:
"v"
(
init_of_object
obj
))
in
(
memvar_s
et_init
seq
loc
init
)
::
(
memvar_s
tored
seq
obj
loc
v
)
::
Assert
(
monotonic_initialized
seq
obj
x
ofs
)
::
Assert
(
monotonic_initialized
seq
obj
x
ofs
)
::
[
memvar_s
tored
seq
obj
loc
v
]
(
memvar_s
et_init
seq
x
ofs
init
)
|
_
->
failwith
"MemVar assigned on a non MemVar location"
|
_
->
failwith
"MemVar assigned on a non MemVar location"
let
assigned_loc
seq
obj
=
function
let
assigned_loc
seq
obj
=
function
...
@@ -1339,8 +1333,8 @@ struct
...
@@ -1339,8 +1333,8 @@ struct
let
ofs
=
ofs_shift
elt
(
e_var
k
)
ofs
in
let
ofs
=
ofs_shift
elt
(
e_var
k
)
ofs
in
let
obj_x
=
Ctypes
.
object_of
x
.
vtype
in
let
obj_x
=
Ctypes
.
object_of
x
.
vtype
in
let
init
=
e_var
(
Lang
.
freshvar
~
basename
:
"v"
(
init_of_object
obj_x
))
in
let
init
=
e_var
(
Lang
.
freshvar
~
basename
:
"v"
(
init_of_object
obj_x
))
in
(
memvar_set_init
seq
(
Val
(
m
,
x
,
[]
))
init
)
::
Assert
(
monotonic_initialized
seq
obj_x
x
[]
)
::
Assert
(
monotonic_initialized
seq
obj_x
x
[]
)
::
(
memvar_set_init
seq
x
[]
init
)
@
(
assigned_genset
seq
[
k
]
m
x
ofs
p
)
(
assigned_genset
seq
[
k
]
m
x
ofs
p
)
let
assigned_descr
seq
obj
xs
l
p
=
let
assigned_descr
seq
obj
xs
l
p
=
...
@@ -1353,8 +1347,8 @@ struct
...
@@ -1353,8 +1347,8 @@ struct
|
Val
((
CVAL
|
CREF
)
as
m
,
x
,
ofs
)
->
|
Val
((
CVAL
|
CREF
)
as
m
,
x
,
ofs
)
->
let
obj_x
=
Ctypes
.
object_of
x
.
vtype
in
let
obj_x
=
Ctypes
.
object_of
x
.
vtype
in
let
init
=
e_var
(
Lang
.
freshvar
~
basename
:
"v"
(
init_of_object
obj_x
))
in
let
init
=
e_var
(
Lang
.
freshvar
~
basename
:
"v"
(
init_of_object
obj_x
))
in
(
memvar_set_init
seq
(
Val
(
m
,
x
,
[]
))
init
)
::
Assert
(
monotonic_initialized
seq
obj_x
x
[]
)
::
Assert
(
monotonic_initialized
seq
obj_x
x
[]
)
::
(
memvar_set_init
seq
x
[]
init
)
@
(
assigned_genset
seq
xs
m
x
ofs
p
)
(
assigned_genset
seq
xs
m
x
ofs
p
)
let
assigned
seq
obj
=
function
let
assigned
seq
obj
=
function
...
...
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