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
5715c2fe
Commit
5715c2fe
authored
5 years ago
by
Virgile Prevosto
Browse files
Options
Downloads
Patches
Plain Diff
[crowbar] again refine oracle
parent
8dfb226a
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
tests/crowbar/test_ghost_cfg.ml
+16
-1
16 additions, 1 deletion
tests/crowbar/test_ghost_cfg.ml
with
16 additions
and
1 deletion
tests/crowbar/test_ghost_cfg.ml
+
16
−
1
View file @
5715c2fe
...
@@ -279,6 +279,8 @@ let ghost_case_breaks has_default other_cases =
...
@@ -279,6 +279,8 @@ let ghost_case_breaks has_default other_cases =
method
!
vstmt
s
=
method
!
vstmt
s
=
match
s
.
skind
with
match
s
.
skind
with
|
Break
_
->
raise
M
.
Has_break
|
Break
_
->
raise
M
.
Has_break
|
Loop
_
|
Switch
_
->
(* a break there won't break the switch *)
Cil
.
SkipChildren
|
_
->
Cil
.
DoChildren
|
_
->
Cil
.
DoChildren
end
end
in
in
...
@@ -288,6 +290,19 @@ let ghost_case_breaks has_default other_cases =
...
@@ -288,6 +290,19 @@ let ghost_case_breaks has_default other_cases =
false
false
with
M
.
Has_break
->
true
with
M
.
Has_break
->
true
let
rec
no_ghost_case_breaks
=
function
|
[]
->
false
(* should not happen, we have at least one non-ghost case before
default. *)
|
stmts
::
others
->
if
(
List
.
hd
stmts
)
.
ghost
then
begin
match
(
Extlib
.
last
stmts
)
.
skind
with
|
Break
_
->
false
|
_
->
no_ghost_case_breaks
others
end
else
true
let
gen_case
ghost
should_break
my_case
cases
env
=
let
gen_case
ghost
should_break
my_case
cases
env
=
let
(
env
,
default
,
others
)
=
cases
env
in
let
(
env
,
default
,
others
)
=
cases
env
in
let
ghost
=
ghost_status
env
ghost
in
let
ghost
=
ghost_status
env
ghost
in
...
@@ -314,7 +329,7 @@ let gen_case ghost should_break my_case cases env =
...
@@ -314,7 +329,7 @@ let gen_case ghost should_break my_case cases env =
|
Case_no_default
g1
,
(
_
,
g2
)
::_
->
|
Case_no_default
g1
,
(
_
,
g2
)
::_
->
(* fails iff switch is non-ghost, current case is, and doesn't break,
(* fails iff switch is non-ghost, current case is, and doesn't break,
going to the next case. *)
going to the next case. *)
not
g2
&&
g1
&&
not
should_break
not
g2
&&
g1
&&
not
should_break
&&
no_ghost_case_breaks
others
|
Case
g1
,
(
_
,
g2
)
::
_
->
|
Case
g1
,
(
_
,
g2
)
::
_
->
not
g2
&&
g1
(* prevents taking the default clause.*)
not
g2
&&
g1
(* prevents taking the default clause.*)
in
in
...
...
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