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
91fe6e38
Commit
91fe6e38
authored
4 years ago
by
Loïc Correnson
Browse files
Options
Downloads
Patches
Plain Diff
[logic] clarify expr-to-boolean for comparisons
parent
2c5dfa53
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/kernel_services/ast_queries/logic_utils.ml
+8
-1
8 additions, 1 deletion
src/kernel_services/ast_queries/logic_utils.ml
with
8 additions
and
1 deletion
src/kernel_services/ast_queries/logic_utils.ml
+
8
−
1
View file @
91fe6e38
...
@@ -413,6 +413,13 @@ let is_boolean_binop op =
...
@@ -413,6 +413,13 @@ let is_boolean_binop op =
|
PlusA
|
PlusPI
|
IndexPI
|
MinusA
|
MinusPI
|
MinusPP
|
PlusA
|
PlusPI
|
IndexPI
|
MinusA
|
MinusPI
|
MinusPP
|
Mult
|
Div
|
Mod
|
Shiftlt
|
Shiftrt
|
BAnd
|
BXor
|
BOr
->
false
|
Mult
|
Div
|
Mod
|
Shiftlt
|
Shiftrt
|
BAnd
|
BXor
|
BOr
->
false
let
is_comparison_binop
op
=
let
open
Cil_types
in
match
op
with
|
Lt
|
Gt
|
Le
|
Ge
|
Eq
|
Ne
->
true
|
PlusA
|
PlusPI
|
IndexPI
|
MinusA
|
MinusPI
|
MinusPP
|
Mult
|
Div
|
Mod
|
Shiftlt
|
Shiftrt
|
BAnd
|
BXor
|
BOr
|
LAnd
|
LOr
->
false
let
float_builtin
prefix
fkind
=
let
float_builtin
prefix
fkind
=
let
name
=
match
fkind
with
let
name
=
match
fkind
with
|
FFloat
->
Printf
.
sprintf
"
\\
%s_float"
prefix
|
FFloat
->
Printf
.
sprintf
"
\\
%s_float"
prefix
...
@@ -518,7 +525,7 @@ and expr_to_boolean e =
...
@@ -518,7 +525,7 @@ and expr_to_boolean e =
let
va
=
expr_to_boolean
a
in
let
va
=
expr_to_boolean
a
in
let
vb
=
expr_to_boolean
b
in
let
vb
=
expr_to_boolean
b
in
tbool
@@
TBinOp
(
op
,
va
,
vb
)
tbool
@@
TBinOp
(
op
,
va
,
vb
)
|
BinOp
(
op
,
a
,
b
,
_
)
when
is_
boolea
n_binop
op
->
|
BinOp
(
op
,
a
,
b
,
_
)
when
is_
compariso
n_binop
op
->
let
va
=
expr_to_term
~
coerce
:
true
a
in
let
va
=
expr_to_term
~
coerce
:
true
a
in
let
vb
=
expr_to_term
~
coerce
:
true
b
in
let
vb
=
expr_to_term
~
coerce
:
true
b
in
tbool
@@
TBinOp
(
op
,
va
,
vb
)
tbool
@@
TBinOp
(
op
,
va
,
vb
)
...
...
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