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
3441230f
Commit
3441230f
authored
4 years ago
by
Basile Desloges
Browse files
Options
Downloads
Patches
Plain Diff
[eacsl] Add support for logic arrays in `Translate.comparison_to_exp`
parent
52b0e43a
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/code_generator/translate.ml
+41
-23
41 additions, 23 deletions
src/plugins/e-acsl/src/code_generator/translate.ml
with
41 additions
and
23 deletions
src/plugins/e-acsl/src/code_generator/translate.ml
+
41
−
23
View file @
3441230f
...
@@ -762,29 +762,46 @@ and comparison_to_exp
...
@@ -762,29 +762,46 @@ and comparison_to_exp
|
Some
e1
->
|
Some
e1
->
e1
,
env
e1
,
env
in
in
let
ty1
=
Cil
.
typeOf
e1
in
let
e2
,
env
=
term_to_exp
kf
env
t2
in
let
e2
,
env
=
term_to_exp
kf
env
t2
in
match
ity
with
let
ty2
=
Cil
.
typeOf
e2
in
|
Typing
.
C_integer
_
|
Typing
.
C_float
_
|
Typing
.
Nan
->
match
Logic_array
.
is_array
ty1
,
Logic_array
.
is_array
ty2
with
Cil
.
mkBinOp
~
loc
bop
e1
e2
,
env
|
true
,
true
->
|
Typing
.
Gmpz
->
Logic_array
.
comparison_to_exp
let
_
,
e
,
env
=
Env
.
new_var
~
loc
~
loc
kf
env
env
kf
~
name
t_opt
bop
~
name
e1
Cil
.
intType
e2
(
fun
v
_
->
|
false
,
false
->
(
[
Constructor
.
mk_lib_call
~
loc
match
ity
with
~
result
:
(
Cil
.
var
v
)
|
Typing
.
C_integer
_
|
Typing
.
C_float
_
|
Typing
.
Nan
->
"__gmpz_cmp"
Cil
.
mkBinOp
~
loc
bop
e1
e2
,
env
[
e1
;
e2
]
])
|
Typing
.
Gmpz
->
in
let
_
,
e
,
env
=
Env
.
new_var
Cil
.
new_exp
~
loc
(
BinOp
(
bop
,
e
,
Cil
.
zero
~
loc
,
Cil
.
intType
))
,
env
~
loc
|
Typing
.
Rational
->
env
Rational
.
cmp
~
loc
bop
e1
e2
env
kf
t_opt
kf
|
Typing
.
Real
->
t_opt
Error
.
not_yet
"comparison involving real numbers"
~
name
Cil
.
intType
(
fun
v
_
->
[
Constructor
.
mk_lib_call
~
loc
~
result
:
(
Cil
.
var
v
)
"__gmpz_cmp"
[
e1
;
e2
]
])
in
Cil
.
new_exp
~
loc
(
BinOp
(
bop
,
e
,
Cil
.
zero
~
loc
,
Cil
.
intType
))
,
env
|
Typing
.
Rational
->
Rational
.
cmp
~
loc
bop
e1
e2
env
kf
t_opt
|
Typing
.
Real
->
Error
.
not_yet
"comparison involving real numbers"
)
|
_
,
_
->
Options
.
fatal
~
current
:
true
"Comparison involving an array with something \
else."
and
at_to_exp_no_lscope
env
kf
t_opt
label
e
=
and
at_to_exp_no_lscope
env
kf
t_opt
label
e
=
let
stmt
=
E_acsl_label
.
get_stmt
kf
label
in
let
stmt
=
E_acsl_label
.
get_stmt
kf
label
in
...
@@ -1080,7 +1097,8 @@ let () =
...
@@ -1080,7 +1097,8 @@ let () =
Mmodel_translate
.
term_to_exp_ref
:=
term_to_exp
;
Mmodel_translate
.
term_to_exp_ref
:=
term_to_exp
;
Mmodel_translate
.
predicate_to_exp_ref
:=
named_predicate_to_exp
;
Mmodel_translate
.
predicate_to_exp_ref
:=
named_predicate_to_exp
;
Logic_functions
.
term_to_exp_ref
:=
term_to_exp
;
Logic_functions
.
term_to_exp_ref
:=
term_to_exp
;
Logic_functions
.
named_predicate_to_exp_ref
:=
named_predicate_to_exp
Logic_functions
.
named_predicate_to_exp_ref
:=
named_predicate_to_exp
;
Logic_array
.
translate_rte_ref
:=
translate_rte
(* This function is used by Guillaume.
(* This function is used by Guillaume.
However, it is correct to use it only in specific contexts. *)
However, it is correct to use it only in specific contexts. *)
...
...
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