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
330266df
Commit
330266df
authored
4 years ago
by
Julien Signoles
Browse files
Options
Downloads
Patches
Plain Diff
[e-acsl] preserve property statuses again
parent
dfd5bdf3
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/e-acsl/src/analyses/rte.ml
+13
-30
13 additions, 30 deletions
src/plugins/e-acsl/src/analyses/rte.ml
src/plugins/e-acsl/src/analyses/rte.mli
+1
-1
1 addition, 1 deletion
src/plugins/e-acsl/src/analyses/rte.mli
src/plugins/e-acsl/src/main.ml
+20
-4
20 additions, 4 deletions
src/plugins/e-acsl/src/main.ml
with
34 additions
and
35 deletions
src/plugins/e-acsl/src/analyses/rte.ml
+
13
−
30
View file @
330266df
...
@@ -24,17 +24,6 @@
...
@@ -24,17 +24,6 @@
(** {2 Generic code} *)
(** {2 Generic code} *)
(* ************************************************************************** *)
(* ************************************************************************** *)
let
apply_rte
f
x
=
let
signed
=
Kernel
.
SignedOverflow
.
get
()
in
let
unsigned
=
Kernel
.
UnsignedOverflow
.
get
()
in
Kernel
.
SignedOverflow
.
off
()
;
Kernel
.
UnsignedOverflow
.
off
()
;
let
finally
()
=
Kernel
.
SignedOverflow
.
set
signed
;
Kernel
.
UnsignedOverflow
.
set
unsigned
in
Extlib
.
try_finally
~
finally
f
x
let
warn_rte
warn
exn
=
let
warn_rte
warn
exn
=
if
warn
then
if
warn
then
Options
.
warning
"@[@[cannot run RTE:@ %s.@]@ \
Options
.
warning
"@[@[cannot run RTE:@ %s.@]@ \
...
@@ -48,30 +37,24 @@ Ignoring potential runtime errors in annotations."
...
@@ -48,30 +37,24 @@ Ignoring potential runtime errors in annotations."
open
Cil_datatype
open
Cil_datatype
let
stmt
?
(
warn
=
true
)
=
let
stmt
?
(
warn
=
true
)
=
try
try
let
f
=
Dynamic
.
get
Dynamic
.
get
~
plugin
:
"RteGen"
~
plugin
:
"RteGen"
"stmt_annotations"
"stmt_annotations"
(
Datatype
.
func2
Kernel_function
.
ty
Stmt
.
ty
(
Datatype
.
func2
Kernel_function
.
ty
Stmt
.
ty
(
let
module
L
=
Datatype
.
List
(
Code_annotation
)
in
L
.
ty
))
(
let
module
L
=
Datatype
.
List
(
Code_annotation
)
in
L
.
ty
))
in
(
fun
x
y
->
apply_rte
(
f
x
)
y
)
with
Failure
_
|
Dynamic
.
Unbound_value
_
|
Dynamic
.
Incompatible_type
_
as
exn
with
Failure
_
|
Dynamic
.
Unbound_value
_
|
Dynamic
.
Incompatible_type
_
as
exn
->
->
warn_rte
warn
exn
;
warn_rte
warn
exn
;
fun
_
_
->
[]
fun
_
_
->
[]
let
exp
?
(
warn
=
true
)
=
let
exp
?
(
warn
=
true
)
=
try
try
let
f
=
Dynamic
.
get
Dynamic
.
get
~
plugin
:
"RteGen"
~
plugin
:
"RteGen"
"exp_annotations"
"exp_annotations"
(
Datatype
.
func3
Kernel_function
.
ty
Stmt
.
ty
Exp
.
ty
(
Datatype
.
func3
Kernel_function
.
ty
Stmt
.
ty
Exp
.
ty
(
let
module
L
=
Datatype
.
List
(
Code_annotation
)
in
L
.
ty
))
(
let
module
L
=
Datatype
.
List
(
Code_annotation
)
in
L
.
ty
))
in
(
fun
x
y
z
->
apply_rte
(
f
x
y
)
z
)
with
Failure
_
|
Dynamic
.
Unbound_value
_
|
Dynamic
.
Incompatible_type
_
as
exn
with
Failure
_
|
Dynamic
.
Unbound_value
_
|
Dynamic
.
Incompatible_type
_
as
exn
->
->
warn_rte
warn
exn
;
warn_rte
warn
exn
;
...
@@ -79,6 +62,6 @@ let exp ?(warn=true) =
...
@@ -79,6 +62,6 @@ let exp ?(warn=true) =
(*
(*
Local Variables:
Local Variables:
compile-command: "make"
compile-command: "make
-C ../../../../..
"
End:
End:
*)
*)
This diff is collapsed.
Click to expand it.
src/plugins/e-acsl/src/analyses/rte.mli
+
1
−
1
View file @
330266df
...
@@ -32,6 +32,6 @@ val exp: ?warn:bool -> kernel_function -> stmt -> exp -> code_annotation list
...
@@ -32,6 +32,6 @@ val exp: ?warn:bool -> kernel_function -> stmt -> exp -> code_annotation list
(*
(*
Local Variables:
Local Variables:
compile-command: "make"
compile-command: "make
-C ../../../../..
"
End:
End:
*)
*)
This diff is collapsed.
Click to expand it.
src/plugins/e-acsl/src/main.ml
+
20
−
4
View file @
330266df
...
@@ -50,9 +50,6 @@ let generate_code =
...
@@ -50,9 +50,6 @@ let generate_code =
(
fun
name
->
(
fun
name
->
Options
.
feedback
"beginning translation."
;
Options
.
feedback
"beginning translation."
;
Temporal
.
enable
(
Options
.
Temporal_validity
.
get
()
);
Temporal
.
enable
(
Options
.
Temporal_validity
.
get
()
);
let
rtl_prj
=
Project
.
create_by_copy
~
last
:
false
"E_ACSL RTL"
in
if
Plugin
.
is_present
"variadic"
then
begin
if
Plugin
.
is_present
"variadic"
then
begin
let
opt_name
=
"-variadic-translation"
in
let
opt_name
=
"-variadic-translation"
in
if
Dynamic
.
Parameter
.
Bool
.
get
opt_name
()
then
begin
if
Dynamic
.
Parameter
.
Bool
.
get
opt_name
()
then
begin
...
@@ -64,6 +61,11 @@ let generate_code =
...
@@ -64,6 +61,11 @@ let generate_code =
Dynamic
.
Parameter
.
Bool
.
off
opt_name
()
;
Dynamic
.
Parameter
.
Bool
.
off
opt_name
()
;
end
end
end
;
end
;
(* slightly more efficient to copy the project before computing the AST
if it is not yet computed *)
let
rtl_prj
=
Project
.
create_by_copy
~
last
:
false
"E_ACSL RTL"
in
(* TODO: remove [rtl_prj] after use if no debug mode *)
(* force AST computation before copying the project it belongs to *)
Ast
.
compute
()
;
Ast
.
compute
()
;
let
copied_prj
=
Project
.
create_by_copy
~
last
:
true
name
in
let
copied_prj
=
Project
.
create_by_copy
~
last
:
true
name
in
Project
.
on
Project
.
on
...
@@ -72,7 +74,21 @@ let generate_code =
...
@@ -72,7 +74,21 @@ let generate_code =
(* preparation of the AST does not concern the E-ACSL RTL *)
(* preparation of the AST does not concern the E-ACSL RTL *)
Prepare_ast
.
prepare
()
;
Prepare_ast
.
prepare
()
;
Rtl
.
link
rtl_prj
;
Rtl
.
link
rtl_prj
;
Injector
.
inject
()
;
(* the E-ACSL type system ensures the soundness of the generated
arithmetic operations. Therefore, deactivate the corresponding
options in order to prevent RTE to generate spurious alarms. *)
let
signed
=
Kernel
.
SignedOverflow
.
get
()
in
let
unsigned
=
Kernel
.
UnsignedOverflow
.
get
()
in
(* we do know that setting these flags does not modify the program's
semantics: using their unsafe variants is thus safe and preserve
all emitted property statuses. *)
Kernel
.
SignedOverflow
.
unsafe_set
false
;
Kernel
.
UnsignedOverflow
.
unsafe_set
false
;
let
finally
()
=
Kernel
.
SignedOverflow
.
unsafe_set
signed
;
Kernel
.
UnsignedOverflow
.
unsafe_set
unsigned
in
Extlib
.
try_finally
~
finally
Injector
.
inject
()
;
(* remove the RTE's results computed from E-ACSL: they are partial
(* remove the RTE's results computed from E-ACSL: they are partial
and associated with the wrong kernel function (the one of the old
and associated with the wrong kernel function (the one of the old
project). *)
project). *)
...
...
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