forked from diffblue/cbmc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request diffblue#415 from diffblue/CBMC_merge_2018-05-15
Cbmc merge 2018-05-15
- Loading branch information
Showing
17 changed files
with
304 additions
and
41 deletions.
There are no files selected for viewing
Binary file added
BIN
+1.46 KB
cbmc/regression/cbmc-java/phi-merge_uninitialized_values/PhiMergeUninitialized.class
Binary file not shown.
54 changes: 54 additions & 0 deletions
54
cbmc/regression/cbmc-java/phi-merge_uninitialized_values/PhiMergeUninitialized.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
public class PhiMergeUninitialized { | ||
|
||
public int dynamicAllocationUninitialized(Boolean trigger) { | ||
|
||
Ephemeral obj; | ||
if (trigger) { | ||
obj = new Ephemeral(42); | ||
} else { | ||
obj = new Aetherial(20); | ||
} | ||
|
||
assert obj.val == 20; | ||
return obj.val; | ||
} | ||
|
||
private Ephemeral field; | ||
|
||
public int fieldUninitialized(Boolean trigger) { | ||
if (trigger) { | ||
field = new Ephemeral(42); | ||
} | ||
|
||
assert field.val == 42; | ||
return field.val; | ||
} | ||
|
||
private static Ephemeral staticField; | ||
|
||
public int staticFieldUninitialized(Boolean trigger) { | ||
if (trigger) { | ||
staticField = new Ephemeral(42); | ||
} else { | ||
staticField = new Aetherial(76); | ||
} | ||
|
||
assert staticField.val == 76; | ||
return staticField.val; | ||
} | ||
|
||
class Ephemeral { | ||
Ephemeral(int value) { | ||
val = value; | ||
} | ||
|
||
int val; | ||
} | ||
|
||
class Aetherial extends Ephemeral { | ||
Aetherial(int value) { | ||
super(value); | ||
} | ||
} | ||
} | ||
|
16 changes: 16 additions & 0 deletions
16
cbmc/regression/cbmc-java/phi-merge_uninitialized_values/field.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
CORE | ||
PhiMergeUninitialized.class | ||
--function PhiMergeUninitialized.fieldUninitialized --show-vcc | ||
activate-multi-line-match | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
-- | ||
^.*:\s+(dynamic_object|new_tmp)[0-9]+(@[0-9]+)?#0\) | ||
^.*\?\s+(dynamic_object|new_tmp)[0-9]+(@[0-9]+)?#0\s+: | ||
-- | ||
These regexes are making sure that a variable of generation 0 dosen't appear in a phi merge, so the below | ||
statement: | ||
|
||
(guard ? dynamic_object2@3#1 : dynamic_object3@3#0) | ||
|
||
Should not appear. First regex deals with when the gen zero is the latter position, second when it's in the former. |
16 changes: 16 additions & 0 deletions
16
cbmc/regression/cbmc-java/phi-merge_uninitialized_values/local.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
CORE | ||
PhiMergeUninitialized.class | ||
--function PhiMergeUninitialized.dynamicAllocationUninitialized --show-vcc | ||
activate-multi-line-match | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
-- | ||
^.*:\s+(dynamic_object|new_tmp)[0-9]+(@[0-9]+)?#0\) | ||
^.*\?\s+(dynamic_object|new_tmp)[0-9]+(@[0-9]+)?#0\s+: | ||
-- | ||
These regexes are making sure that a variable of generation 0 dosen't appear in a phi merge, so the below | ||
statement: | ||
|
||
(guard ? dynamic_object2@3#1 : dynamic_object3@3#0) | ||
|
||
Should not appear. First regex deals with when the gen zero is the latter position, second when it's in the former. |
16 changes: 16 additions & 0 deletions
16
cbmc/regression/cbmc-java/phi-merge_uninitialized_values/static_field.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
CORE | ||
PhiMergeUninitialized.class | ||
--function PhiMergeUninitialized.staticFieldUninitialized --show-vcc | ||
activate-multi-line-match | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
-- | ||
^.*:\s+(dynamic_object|new_tmp)[0-9]+(@[0-9]+)?#0\) | ||
^.*\?\s+(dynamic_object|new_tmp)[0-9]+(@[0-9]+)?#0\s+: | ||
-- | ||
These regexes are making sure that a variable of generation 0 dosen't appear in a phi merge, so the below | ||
statement: | ||
|
||
(guard ? dynamic_object2@3#1 : dynamic_object3@3#0) | ||
|
||
Should not appear. First regex deals with when the gen zero is the latter position, second when it's in the former. |
16 changes: 16 additions & 0 deletions
16
cbmc/regression/cbmc/phi-merge_uninitialized_values/dynamic.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
CORE | ||
test.c | ||
--function dynamicAllocationUninitialized --show-vcc | ||
activate-multi-line-match | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
-- | ||
^.*:\s+dynamic_object[0-9]+(@[0-9]+)?#0\) | ||
^.*\?\s+dynamic_object[0-9]+(@[0-9]+)?#0\s+: | ||
-- | ||
These regexes are making sure that a variable of generation 0 dosen't appear in a phi merge, so the below | ||
statement: | ||
|
||
(guard ? dynamic_object2@3#1 : dynamic_object3@3#0) | ||
|
||
Should not appear. First regex deals with when the gen zero is the latter position, second when it's in the former. |
16 changes: 16 additions & 0 deletions
16
cbmc/regression/cbmc/phi-merge_uninitialized_values/global.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
CORE | ||
test.c | ||
--function globalUninitialized --show-vcc | ||
activate-multi-line-match | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
-- | ||
^.*:\s+global(@[0-9]+)?#0\) | ||
^.*\?\s+global(@[0-9]+)?#0\s+: | ||
-- | ||
These regexes are making sure that a variable of generation 0 dosen't appear in a phi merge, so the below | ||
statement: | ||
|
||
(guard ? global#1 : global#0) | ||
|
||
Should not appear. First regex deals with when the gen zero is the latter position, second when it's in the former. |
16 changes: 16 additions & 0 deletions
16
cbmc/regression/cbmc/phi-merge_uninitialized_values/local.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
CORE | ||
test.c | ||
--function localUninitialized --show-vcc | ||
activate-multi-line-match | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
-- | ||
^.*:\s+local(@[0-9]+)?#0\) | ||
^.*\?\s+local(@[0-9]+)?#0\s+: | ||
-- | ||
These regexes are making sure that a variable of generation 0 dosen't appear in a phi merge, so the below | ||
statement: | ||
|
||
(guard ? local#1 : local#0) | ||
|
||
Should not appear. First regex deals with when the gen zero is the latter position, second when it's in the former. |
16 changes: 16 additions & 0 deletions
16
cbmc/regression/cbmc/phi-merge_uninitialized_values/static_local.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
CORE | ||
test.c | ||
--function staticLocalUninitialized --show-vcc | ||
activate-multi-line-match | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
-- | ||
^.*:\s+staticLocal(@[0-9]+)?#0\) | ||
^.*\?\s+staticLocal(@[0-9]+)?#0\s+: | ||
-- | ||
These regexes are making sure that a variable of generation 0 dosen't appear in a phi merge, so the below | ||
statement: | ||
|
||
(guard ? staticLocal#1 : dynamic_object#0) | ||
|
||
Should not appear. First regex deals with when the gen zero is the latter position, second when it's in the former. |
56 changes: 56 additions & 0 deletions
56
cbmc/regression/cbmc/phi-merge_uninitialized_values/test.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#include <assert.h> | ||
#include <stdlib.h> | ||
|
||
void dynamicAllocationUninitialized(int trigger) | ||
{ | ||
int *obj; | ||
if(trigger) | ||
{ | ||
obj = (int *)malloc(sizeof(int)); | ||
*obj = 42; | ||
} | ||
else | ||
{ | ||
obj = (int *)malloc(sizeof(int)); | ||
*obj = 76; | ||
} | ||
|
||
assert(*obj == 42); | ||
} | ||
|
||
int global; | ||
void globalUninitialized(int trigger) | ||
{ | ||
if(trigger) | ||
{ | ||
global = 44; | ||
} | ||
else | ||
{ | ||
global = 20; | ||
} | ||
|
||
assert(global == 44); | ||
} | ||
|
||
void staticLocalUninitialized(int trigger) | ||
{ | ||
static int staticLocal; | ||
if(trigger) | ||
{ | ||
staticLocal = 43; | ||
} | ||
|
||
assert(staticLocal == 43); | ||
} | ||
|
||
void localUninitialized(int trigger) | ||
{ | ||
int local; | ||
if(trigger) | ||
{ | ||
local = 24; | ||
} | ||
|
||
assert(local == 24); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.