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
ff19ee73
Commit
ff19ee73
authored
1 year ago
by
Loïc Correnson
Committed by
David Bühler
3 months ago
Browse files
Options
Downloads
Patches
Plain Diff
[eva] annotate dead code
parent
6c9b9f99
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/eva/utils/annot.ml
+8
-4
8 additions, 4 deletions
src/plugins/eva/utils/annot.ml
tests/misc/eva_annot_dead.c
+17
-0
17 additions, 0 deletions
tests/misc/eva_annot_dead.c
tests/misc/oracle/eva_annot_dead.res.oracle
+42
-0
42 additions, 0 deletions
tests/misc/oracle/eva_annot_dead.res.oracle
with
67 additions
and
4 deletions
src/plugins/eva/utils/annot.ml
+
8
−
4
View file @
ff19ee73
...
@@ -250,9 +250,13 @@ let eval_instr ?callstack ?name stmt =
...
@@ -250,9 +250,13 @@ let eval_instr ?callstack ?name stmt =
match
callstack
with
match
callstack
with
|
None
->
r
|
None
->
r
|
Some
c
->
Results
.
in_callstack
c
r
in
|
Some
c
->
Results
.
in_callstack
c
r
in
let
engine
=
new
evaluator
request
in
List
.
map
(
predicate
?
name
~
loc
:
(
Cil_datatype
.
Stmt
.
loc
stmt
))
@@
let
_
=
Visitor
.
visitFramacStmt
(
engine
:>
visitor
)
stmt
in
if
Results
.
is_empty
request
then
[
False
]
else
List
.
map
(
predicate
?
name
~
loc
:
(
Cil_datatype
.
Stmt
.
loc
stmt
))
engine
#
flush
let
engine
=
new
evaluator
request
in
let
_
=
Visitor
.
visitFramacStmt
(
engine
:>
visitor
)
stmt
in
engine
#
flush
let
is_dead
stmt
=
Results
.
is_empty
@@
Results
.
before
stmt
(* -------------------------------------------------------------------------- *)
(* -------------------------------------------------------------------------- *)
(* --- Annotation Generator --- *)
(* --- Annotation Generator --- *)
...
@@ -285,7 +289,7 @@ class generator =
...
@@ -285,7 +289,7 @@ class generator =
Property_status
.
emit
Analysis
.
emitter
~
hyps
:
[]
ip
True
Property_status
.
emit
Analysis
.
emitter
~
hyps
:
[]
ip
True
)
(
Property
.
ip_of_code_annot
kf
stmt
ca
)
)
(
Property
.
ip_of_code_annot
kf
stmt
ca
)
)
stmt
;
)
stmt
;
DoChildren
if
is_dead
stmt
then
SkipChildren
else
DoChildren
end
end
...
...
This diff is collapsed.
Click to expand it.
tests/misc/eva_annot_dead.c
0 → 100644
+
17
−
0
View file @
ff19ee73
/* run.config
PLUGIN: @EVA_PLUGINS@
OPT: -eva -eva-annot main -print
*/
/* -------------------------------------------------------------------------- */
/* --- Testing EVA Annotations --- */
/* -------------------------------------------------------------------------- */
int
main
(
int
a
)
{
int
b
=
0
;
if
(
a
<
0
)
{
a
=
1
;
b
++
;
}
if
(
a
<
0
)
{
a
=
2
;
b
++
;
}
return
b
;
}
/* -------------------------------------------------------------------------- */
This diff is collapsed.
Click to expand it.
tests/misc/oracle/eva_annot_dead.res.oracle
0 → 100644
+
42
−
0
View file @
ff19ee73
[kernel] Parsing eva_annot_dead.c (with preprocessing)
[eva] Analyzing a complete application starting at main
[eva:initial-state] Values of globals at initialization
[eva] ====== VALUES COMPUTED ======
[eva:final-states] Values at end of function main:
a ∈ [0..2147483647]
b ∈ {0; 1}
[eva:summary] ====== ANALYSIS SUMMARY ======
----------------------------------------------------------------------------
1 function analyzed (out of 1): 100% coverage.
In this function, 6 statements reached (out of 8): 75% coverage.
----------------------------------------------------------------------------
No errors or warnings raised during the analysis.
----------------------------------------------------------------------------
0 alarms generated by the analysis.
----------------------------------------------------------------------------
No logical properties have been reached by the analysis.
----------------------------------------------------------------------------
[eva] Annotate main
/* Generated by Frama-C */
int main(int a)
{
int b = 0;
/*@ assert Eva_domain: -2147483648 ≤ a ≤ 2147483647; */
if (a < 0) {
a = 1;
/*@ assert Eva_domain: b ≡ 0; */
b ++;
}
/*@ assert Eva_domain: 0 ≤ a ≤ 2147483647; */
if (a < 0) {
/*@ assert Eva_domain: \false; */
a = 2;
/*@ assert Eva_domain: \false; */
b ++;
}
/*@ assert Eva_domain: 0 ≤ b ≤ 1; */
return b;
}
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