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
ff4eb3a1
Commit
ff4eb3a1
authored
3 years ago
by
Thibaut Benjamin
Browse files
Options
Downloads
Patches
Plain Diff
[e-acsl] interval perform recursion on predicates
parent
24c29ebf
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/e-acsl/src/analyses/interval.ml
+60
-10
60 additions, 10 deletions
src/plugins/e-acsl/src/analyses/interval.ml
with
60 additions
and
10 deletions
src/plugins/e-acsl/src/analyses/interval.ml
+
60
−
10
View file @
ff4eb3a1
...
@@ -648,7 +648,7 @@ let rec infer ~logic_env t =
...
@@ -648,7 +648,7 @@ let rec infer ~logic_env t =
in
in
let
n
=
Integer
.
of_int
(
find_idx
0
enumitem
.
eihost
.
eitems
)
in
let
n
=
Integer
.
of_int
(
find_idx
0
enumitem
.
eihost
.
eitems
)
in
singleton
n
singleton
n
|
TLval
lv
->
infer_term_lval
lv
|
TLval
lv
->
infer_term_lval
~
logic_env
lv
|
TSizeOf
ty
->
infer_sizeof
ty
|
TSizeOf
ty
->
infer_sizeof
ty
|
TSizeOfE
t
->
infer_sizeof
(
get_cty
t
)
|
TSizeOfE
t
->
infer_sizeof
(
get_cty
t
)
|
TSizeOfStr
str
->
singleton_of_int
(
String
.
length
str
+
1
(* '\0' *)
)
|
TSizeOfStr
str
->
singleton_of_int
(
String
.
length
str
+
1
(* '\0' *)
)
...
@@ -784,19 +784,19 @@ let rec infer ~logic_env t =
...
@@ -784,19 +784,19 @@ let rec infer ~logic_env t =
|
Ttype
_
|
Ttype
_
|
Tempty_set
->
|
Tempty_set
->
Nan
Nan
in
Memo
.
memo
~
profile
:
(
l
ogic_env
.
profile
)
compute
t
in
Memo
.
memo
~
profile
:
(
L
ogic_env
ironment
.
get_profile
logic_env
)
compute
t
and
infer_term_lval
(
host
,
offset
as
tlv
)
=
and
infer_term_lval
~
logic_env
(
host
,
offset
as
tlv
)
=
match
offset
with
match
offset
with
|
TNoOffset
->
infer_term_host
host
|
TNoOffset
->
infer_term_host
~
logic_env
host
|
_
->
|
_
->
let
ty
=
Logic_utils
.
logicCType
(
Cil
.
typeOfTermLval
tlv
)
in
let
ty
=
Logic_utils
.
logicCType
(
Cil
.
typeOfTermLval
tlv
)
in
interv_of_typ
ty
interv_of_typ
ty
and
infer_term_host
thost
=
and
infer_term_host
~
logic_env
thost
=
match
thost
with
match
thost
with
|
TVar
v
->
|
TVar
v
->
(
try
Env
.
find
v
with
Not_found
->
(
try
Logic_environment
.
find
logic_env
v
with
Not_found
->
match
v
.
lv_type
with
match
v
.
lv_type
with
|
Linteger
->
top_ival
|
Linteger
->
top_ival
|
Ctype
(
TFloat
(
fk
,
_
))
->
Float
(
fk
,
None
)
|
Ctype
(
TFloat
(
fk
,
_
))
->
Float
(
fk
,
None
)
...
@@ -815,9 +815,59 @@ and infer_term_host thost =
...
@@ -815,9 +815,59 @@ and infer_term_host thost =
Printer
.
pp_typ
ty
Printer
.
pp_typ
ty
Printer
.
pp_term
t
Printer
.
pp_term
t
let
rec
infer_predicate
~
logic_env
p
=
match
Logic_normalizer
.
get_pred
p
with
|
PoT_term
t
->
ignore
(
infer
~
logic_env
t
)
|
PoT_pred
p
->
match
p
.
pred_content
with
|
Pfalse
|
Ptrue
->
()
|
Papp
(
_
,
_
,
_
)
->
()
(* TODO: Implement this case *)
|
Pdangling
_
->
()
|
Prel
(
_
,
t1
,
t2
)
->
ignore
(
infer
~
logic_env
t1
);
ignore
(
infer
~
logic_env
t2
)
|
Pand
(
p1
,
p2
)
|
Por
(
p1
,
p2
)
|
Pxor
(
p1
,
p2
)
|
Pimplies
(
p1
,
p2
)
|
Piff
(
p1
,
p2
)
->
infer_predicate
~
logic_env
p1
;
infer_predicate
~
logic_env
p2
|
Pnot
p
->
infer_predicate
~
logic_env
p
;
|
Pif
(
t
,
p1
,
p2
)
->
ignore
(
infer
~
logic_env
t
);
infer_predicate
~
logic_env
p1
;
infer_predicate
~
logic_env
p2
|
Plet
(
li
,
p
)
->
let
li_t
=
Misc
.
term_of_li
li
in
let
li_v
=
li
.
l_var_info
in
let
i
=
infer
~
logic_env
li_t
in
let
logic_env
=
Error
.
map
(
Logic_environment
.
add_let_quantif_binding
logic_env
li_v
)
i
in
(
infer_predicate
~
logic_env
p
)
|
Pforall
_
|
Pexists
_
->
()
(* TODO: *)
|
Pseparated
tlist
->
List
.
iter
(
fun
t
->
ignore
(
infer
~
logic_env
t
))
tlist
;
|
Pinitialized
(
_
,
t
)
|
Pfreeable
(
_
,
t
)
|
Pallocable
(
_
,
t
)
|
Pvalid
(
_
,
t
)
|
Pvalid_read
(
_
,
t
)
|
Pobject_pointer
(
_
,
t
)
|
Pvalid_function
t
->
ignore
(
infer
~
logic_env
t
);
|
Pat
(
p
,
_
)
->
infer_predicate
~
logic_env
p
|
Pfresh
_
->
Error
.
not_yet
"
\\
fresh"
let
infer
t
=
let
infer
t
=
let
i
=
infer
t
in
let
i
=
infer
t
in
Logic_function_env
.
clear
()
;
i
i
include
D
include
D
...
@@ -828,11 +878,11 @@ let typer_visitor ~logic_env = object
...
@@ -828,11 +878,11 @@ let typer_visitor ~logic_env = object
(* global logic functions and predicates are evaluated are callsites *)
(* global logic functions and predicates are evaluated are callsites *)
method
!
glob_annot
_
=
Cil
.
SkipChildren
method
!
glob_annot
_
=
Cil
.
SkipChildren
method
!
v
term
t
=
method
!
v
predicate
p
=
(* Do not raise a warning for e-acsl errors at preprocessing time,
(* Do not raise a warning for e-acsl errors at preprocessing time,
those errrors are stored in the table and warnings are raised at
those errrors are stored in the table and warnings are raised at
translation time*)
translation time
*)
let
_
=
try
i
gnore
(
infer
~
logic_env
t
)
let
_
=
try
i
nfer_predicate
~
logic_env
p
with
Error
.
Not_yet
_
|
Error
.
Typing_error
_
->
()
with
Error
.
Not_yet
_
|
Error
.
Typing_error
_
->
()
in
in
Cil
.
SkipChildren
Cil
.
SkipChildren
...
...
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