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
dd632da8
Commit
dd632da8
authored
5 years ago
by
David Bühler
Browse files
Options
Downloads
Patches
Plain Diff
[Eva] Eval_terms: fixes [predicate_deps].
Used by the Inout plugin, and then indirectly by Memexec.
parent
f587fe2b
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/value/legacy/eval_terms.ml
+22
-23
22 additions, 23 deletions
src/plugins/value/legacy/eval_terms.ml
with
22 additions
and
23 deletions
src/plugins/value/legacy/eval_terms.ml
+
22
−
23
View file @
dd632da8
...
@@ -1534,12 +1534,6 @@ let eval_tlval_as_location ~alarm_mode env t =
...
@@ -1534,12 +1534,6 @@ let eval_tlval_as_location ~alarm_mode env t =
let
s
=
Eval_typ
.
sizeof_lval_typ
r
.
etype
in
let
s
=
Eval_typ
.
sizeof_lval_typ
r
.
etype
in
make_loc
r
.
eover
s
make_loc
r
.
eover
s
let
eval_tlval_as_location_with_deps
~
alarm_mode
env
t
=
let
r
=
eval_term_as_lval
~
alarm_mode
env
t
in
let
s
=
Eval_typ
.
sizeof_lval_typ
r
.
etype
in
(
make_loc
r
.
eover
s
,
r
.
ldeps
)
(* Return a pair of (under-approximating, over-approximating) zones. *)
(* Return a pair of (under-approximating, over-approximating) zones. *)
let
eval_tlval_as_zone_under_over
~
alarm_mode
access
env
t
=
let
eval_tlval_as_zone_under_over
~
alarm_mode
access
env
t
=
let
r
=
eval_term_as_lval
~
alarm_mode
env
t
in
let
r
=
eval_term_as_lval
~
alarm_mode
env
t
in
...
@@ -2587,9 +2581,19 @@ and eval_predicate env pred =
...
@@ -2587,9 +2581,19 @@ and eval_predicate env pred =
(* --- Dependencies of predicates --- *)
(* --- Dependencies of predicates --- *)
(* -------------------------------------------------------------------------- *)
(* -------------------------------------------------------------------------- *)
let
eval_tsets_deps
~
alarm_mode
env
lbl
tsets
=
let
star_tsets
=
deref_tsets
tsets
in
let
r
=
eval_tlval
~
alarm_mode
env
star_tsets
in
let
size_bits
=
Eval_typ
.
sizeof_lval_typ
r
.
etype
in
let
loc
=
make_loc
r
.
eover
size_bits
in
let
zone
=
enumerate_valid_bits
Locations
.
Read
loc
in
Logic_label
.
Map
.
add
lbl
zone
r
.
ldeps
let
predicate_deps
env
pred
=
let
predicate_deps
env
pred
=
let
alarm_mode
=
Ignore
in
let
alarm_mode
=
Ignore
in
let
rec
do_eval
env
p
=
let
rec
do_eval
env
p
=
let
term_deps
term
=
(
eval_term
~
alarm_mode
env
term
)
.
ldeps
in
let
tsets_deps
lbl
tsets
=
eval_tsets_deps
~
alarm_mode
env
lbl
tsets
in
match
p
.
pred_content
with
match
p
.
pred_content
with
|
Ptrue
|
Pfalse
->
empty_logic_deps
|
Ptrue
|
Pfalse
->
empty_logic_deps
...
@@ -2598,11 +2602,10 @@ let predicate_deps env pred =
...
@@ -2598,11 +2602,10 @@ let predicate_deps env pred =
join_logic_deps
(
do_eval
env
p1
)
(
do_eval
env
p2
)
join_logic_deps
(
do_eval
env
p1
)
(
do_eval
env
p2
)
|
Prel
(
_
,
t1
,
t2
)
->
|
Prel
(
_
,
t1
,
t2
)
->
join_logic_deps
(
eval_term
~
alarm_mode
env
t1
)
.
ldeps
join_logic_deps
(
term_deps
t1
)
(
term_deps
t2
)
(
eval_term
~
alarm_mode
env
t2
)
.
ldeps
|
Pif
(
c
,
p1
,
p2
)
->
|
Pif
(
c
,
p1
,
p2
)
->
join_logic_deps
(
eval_term
~
alarm_mode
env
c
)
.
ldeps
join_logic_deps
(
term_deps
c
)
(
join_logic_deps
(
do_eval
env
p1
)
(
do_eval
env
p2
))
(
join_logic_deps
(
do_eval
env
p1
)
(
do_eval
env
p2
))
|
Pat
(
p
,
lbl
)
->
|
Pat
(
p
,
lbl
)
->
...
@@ -2610,21 +2613,17 @@ let predicate_deps env pred =
...
@@ -2610,21 +2613,17 @@ let predicate_deps env pred =
|
Pvalid
(
_
,
tsets
)
|
Pvalid_read
(
_
,
tsets
)
|
Pvalid
(
_
,
tsets
)
|
Pvalid_read
(
_
,
tsets
)
|
Pobject_pointer
(
_
,
tsets
)
|
Pvalid_function
tsets
->
|
Pobject_pointer
(
_
,
tsets
)
|
Pvalid_function
tsets
->
(
eval_term_as_lval
~
alarm_mode
env
tsets
)
.
ldep
s
term_deps
tset
s
|
Pinitialized
(
lbl
,
tsets
)
|
Pdangling
(
lbl
,
tsets
)
->
|
Pinitialized
(
lbl
,
tsets
)
|
Pdangling
(
lbl
,
tsets
)
->
let
loc
,
deploc
=
tsets_deps
lbl
tsets
eval_tlval_as_location_with_deps
~
alarm_mode
env
tsets
in
let
zone
=
enumerate_valid_bits
Locations
.
Read
loc
in
Logic_label
.
Map
.
add
lbl
zone
deploc
|
Pnot
p
->
do_eval
env
p
|
Pnot
p
->
do_eval
env
p
|
Pseparated
ltsets
->
|
Pseparated
ltsets
->
let
evaled
=
List
.
map
(
eval_term_as_lval
~
alarm_mode
env
)
ltsets
in
List
.
fold_left
List
.
fold_left
(
fun
acc
e
->
join_logic_deps
acc
e
.
ldeps
)
(
fun
acc
tsets
->
join_logic_deps
acc
(
tsets_deps
lbl_here
tsets
)
)
empty_logic_deps
evaled
empty_logic_deps
ltsets
|
Pexists
(
l
,
p
)
|
Pforall
(
l
,
p
)
->
|
Pexists
(
l
,
p
)
|
Pforall
(
l
,
p
)
->
let
env
=
bind_logic_vars
env
l
in
let
env
=
bind_logic_vars
env
l
in
...
@@ -2635,19 +2634,19 @@ let predicate_deps env pred =
...
@@ -2635,19 +2634,19 @@ let predicate_deps env pred =
|
Plet
(
_v
,
p
)
->
do_eval
env
p
(* will this work when when we need [_v]
|
Plet
(
_v
,
p
)
->
do_eval
env
p
(* will this work when when we need [_v]
to evaluate [p] ?.. *)
to evaluate [p] ?.. *)
|
Papp
(
li
,
_labels
,
_
args
)
->
begin
|
Papp
(
li
,
_labels
,
args
)
->
begin
if
is_known_predicate
li
.
l_var_info
then
if
is_known_predicate
li
.
l_var_info
then
(* TODO! Must evaluate the arguments, plus the dependencies of the
List
.
fold_left
predicate itself. *
)
(
fun
acc
arg
->
join_logic_deps
acc
(
term_deps
arg
)
)
unsupported
(
Format
.
asprintf
"%a"
Cil_datatype
.
Predicate
.
pretty
p
)
empty_logic_deps
args
else
else
match
Inline
.
inline_predicate
~
inline
~
current
:
env
.
e_cur
p
with
match
Inline
.
inline_predicate
~
inline
~
current
:
env
.
e_cur
p
with
|
None
->
unsupported
(
Format
.
asprintf
"%a"
Cil_datatype
.
Predicate
.
pretty
p
)
|
None
->
unsupported
(
Format
.
asprintf
"%a"
Predicate
.
pretty
p
)
|
Some
p'
->
do_eval
env
p'
|
Some
p'
->
do_eval
env
p'
end
end
|
Pfresh
_
|
Pallocable
_
|
Pfreeable
_
|
Pfresh
_
|
Pallocable
_
|
Pfreeable
_
->
unsupported
(
Format
.
asprintf
"%a"
Cil_datatype
.
Predicate
.
pretty
p
)
->
unsupported
(
Format
.
asprintf
"%a"
Predicate
.
pretty
p
)
in
in
try
Some
(
do_eval
env
pred
)
try
Some
(
do_eval
env
pred
)
with
LogicEvalError
_
->
None
with
LogicEvalError
_
->
None
...
...
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