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
e30616b8
Commit
e30616b8
authored
9 years ago
by
Julien Signoles
Browse files
Options
Downloads
Patches
Plain Diff
[typing] never use GMPs for ptr/array indexes
parent
84c7824a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/plugins/e-acsl/interval.ml
+3
-0
3 additions, 0 deletions
src/plugins/e-acsl/interval.ml
src/plugins/e-acsl/typing.ml
+8
-6
8 additions, 6 deletions
src/plugins/e-acsl/typing.ml
with
11 additions
and
6 deletions
src/plugins/e-acsl/interval.ml
+
3
−
0
View file @
e30616b8
...
@@ -39,6 +39,9 @@ include Datatype.Make
...
@@ -39,6 +39,9 @@ include Datatype.Make
let
name
=
"E_ACSL.Interval.t"
let
name
=
"E_ACSL.Interval.t"
let
reprs
=
[
{
lower
=
Integer
.
zero
;
upper
=
Integer
.
one
}
]
let
reprs
=
[
{
lower
=
Integer
.
zero
;
upper
=
Integer
.
one
}
]
include
Datatype
.
Undefined
include
Datatype
.
Undefined
let
pretty
fmt
i
=
let
pp
=
Integer
.
pretty
~
hexa
:
false
in
Format
.
fprintf
fmt
"[ %a; %a ]"
pp
i
.
lower
pp
i
.
upper
end
)
end
)
(* constructors *)
(* constructors *)
...
...
This diff is collapsed.
Click to expand it.
src/plugins/e-acsl/typing.ml
+
8
−
6
View file @
e30616b8
...
@@ -165,12 +165,14 @@ let coerce ~ctx ~op ty =
...
@@ -165,12 +165,14 @@ let coerce ~ctx ~op ty =
(** {2 Type system} *)
(** {2 Type system} *)
(******************************************************************************)
(******************************************************************************)
let
mk_ctx
c
=
match
c
with
let
mk_ctx
?
(
force
=
false
)
c
=
if
force
then
c
else
match
c
with
|
Other
->
Other
|
Other
->
Other
|
Gmp
|
C_type
_
->
if
Options
.
Gmp_only
.
get
()
then
Gmp
else
c
|
Gmp
|
C_type
_
->
if
Options
.
Gmp_only
.
get
()
then
Gmp
else
c
let
rec
type_term
env
~
ctx
t
=
let
rec
type_term
env
?
force
~
ctx
t
=
let
ctx
=
mk_ctx
ctx
in
let
ctx
=
mk_ctx
?
force
ctx
in
let
dup
ty
=
ty
,
ty
in
let
dup
ty
=
ty
,
ty
in
let
infer
t
=
let
infer
t
=
Cil
.
CurrentLoc
.
set
t
.
term_loc
;
Cil
.
CurrentLoc
.
set
t
.
term_loc
;
...
@@ -296,7 +298,7 @@ let rec type_term env ~ctx t =
...
@@ -296,7 +298,7 @@ let rec type_term env ~ctx t =
let
ctx
=
let
ctx
=
try
try
let
i
=
Interval
.
infer
env
t'
in
let
i
=
Interval
.
infer
env
t'
in
(* nothing to do
more
: [i] is already more precise than what we
(* nothing
more
to do: [i] is already more precise than what we
could infer from the arguments of the cast. Also, do not type the
could infer from the arguments of the cast. Also, do not type the
internal term: possibly it is not even an integer *)
internal term: possibly it is not even an integer *)
ty_of_interv
~
ctx
i
ty_of_interv
~
ctx
i
...
@@ -354,7 +356,7 @@ let rec type_term env ~ctx t =
...
@@ -354,7 +356,7 @@ let rec type_term env ~ctx t =
(* it is a pointer, as well as [t1], while [t2] is a size_t.
(* it is a pointer, as well as [t1], while [t2] is a size_t.
Both [t1] and [t2] must be typed. *)
Both [t1] and [t2] must be typed. *)
ignore
(
type_term
env
~
ctx
:
Other
t1
);
ignore
(
type_term
env
~
ctx
:
Other
t1
);
ignore
(
type_term
env
~
ctx
:
(
size_t
()
)
t2
);
ignore
(
type_term
env
~
force
:
true
~
ctx
:
(
size_t
()
)
t2
);
dup
Other
dup
Other
|
Tapp
(
_
,_,_
)
->
Error
.
not_yet
"logic function application"
|
Tapp
(
_
,_,_
)
->
Error
.
not_yet
"logic function application"
...
@@ -390,7 +392,7 @@ and type_term_offset env = function
...
@@ -390,7 +392,7 @@ and type_term_offset env = function
|
TModel
(
_
,
toff
)
->
type_term_offset
env
toff
|
TModel
(
_
,
toff
)
->
type_term_offset
env
toff
|
TIndex
(
t
,
toff
)
->
|
TIndex
(
t
,
toff
)
->
(* [t] is an array index which must fits into size_t *)
(* [t] is an array index which must fits into size_t *)
ignore
(
type_term
env
~
ctx
:
(
size_t
()
)
t
);
ignore
(
type_term
env
~
force
:
true
~
ctx
:
(
size_t
()
)
t
);
type_term_offset
env
toff
type_term_offset
env
toff
let
rec
type_predicate_named
env
p
=
let
rec
type_predicate_named
env
p
=
...
...
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