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
dba36ec4
Commit
dba36ec4
authored
5 years ago
by
Allan Blanchard
Browse files
Options
Downloads
Patches
Plain Diff
[Builtin] Deals with memset 0
parent
98762796
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/builtin/basic_blocks.ml
+13
-2
13 additions, 2 deletions
src/plugins/builtin/basic_blocks.ml
src/plugins/builtin/memset.ml
+8
-1
8 additions, 1 deletion
src/plugins/builtin/memset.ml
with
21 additions
and
3 deletions
src/plugins/builtin/basic_blocks.ml
+
13
−
2
View file @
dba36ec4
...
...
@@ -210,13 +210,24 @@ and pall_elems_eq ?loc depth t1 value len =
let
tind
=
tvar
ind
in
let
bounds
=
pbounds_incl_excl
?
loc
(
tinteger
0
)
tind
len
in
let
t1_acc
=
taccess
?
loc
t1
tind
in
let
eq
=
peq_unfold
?
loc
(
depth
+
1
)
t1_acc
value
in
let
eq
=
peq_unfold
?
loc
depth
t1_acc
value
in
pforall
?
loc
([
ind
]
,
(
pimplies
?
loc
(
bounds
,
eq
)))
and
pall_fields_eq
?
loc
depth
t1
ci
value
=
let
eq
fi
=
let
lval
=
match
t1
.
term_node
with
TLval
(
lv
)
->
lv
|
_
->
assert
false
in
let
nlval
=
addTermOffsetLval
(
TField
(
fi
,
TNoOffset
))
lval
in
let
term
=
term
?
loc
(
TLval
nlval
)
(
Ctype
fi
.
ftype
)
in
peq_unfold
?
loc
depth
term
value
in
let
eqs
=
List
.
map
eq
ci
.
cfields
in
pands
eqs
and
peq_unfold
?
loc
depth
t1
value
=
match
t1
.
term_type
with
|
Ctype
(
TArray
(
_
,
Some
len
,
_
,
_
))
->
let
len
=
Logic_utils
.
expr_to_term
~
cast
:
false
len
in
pall_elems_eq
?
loc
depth
t1
value
len
pall_elems_eq
?
loc
(
depth
+
1
)
t1
value
len
|
Ctype
(
TComp
(
ci
,
_
,
_
))
->
pall_fields_eq
?
loc
depth
t1
ci
value
|
_
->
prel
?
loc
(
Req
,
t1
,
value
)
let
pseparated_memories
?
loc
p1
len1
p2
len2
=
...
...
This diff is collapsed.
Click to expand it.
src/plugins/builtin/memset.ml
+
8
−
1
View file @
dba36ec4
...
...
@@ -92,7 +92,9 @@ let generate_ensures e loc t ptr value len =
let
content
=
match
e
,
value
with
|
None
,
Some
value
->
[
{
(
pset_len_bytes
~
loc
ptr
value
len
)
with
pred_name
}
]
|
Some
0
,
None
->
[]
|
Some
0
,
None
->
let
value
=
tinteger
~
loc
0
in
[
{
(
pset_len_bytes
~
loc
ptr
value
len
)
with
pred_name
}
]
|
Some
255
,
None
->
[]
|
_
->
assert
false
in
...
...
@@ -128,8 +130,13 @@ let memset_value e =
|
Const
(
CInt64
(
ni
,
_
,
_
))
when
Integer
.
equal
ni
ff
->
Some
255
|
_
->
None
let
is_union_type
=
function
|
TComp
({
cstruct
=
false
}
,
_
,
_
)
->
true
|
_
->
false
let
well_typed_call
=
function
|
[
ptr
;
_
;
_
]
when
any_char_composed_type
(
type_from_arg
ptr
)
->
true
|
[
ptr
;
_
;
_
]
when
is_union_type
(
type_from_arg
ptr
)
->
false
|
[
_
;
value
;
_
]
->
begin
match
memset_value
value
with
|
None
->
false
...
...
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