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.
Browse files
Browse the repository at this point in the history
da61186 Merge pull request diffblue#2182 from diffblue/trace-debug 5acf313 Merge pull request diffblue#2176 from mgudemann/fix/glucose_build_g++ e82dca0 formatting of debug output of traces f891f37 Merge pull request diffblue#2168 from JohnDumbell/bugfix/phi_merge_uninitialized 6faf376 Enable 'm' flag on regex for multi-line tests 646cf29 Add nondet assignment to non-zero'd allocations in symex 213db5f Remove trailing `;` from namespace closing bracket git-subtree-dir: cbmc git-subtree-split: da61186
- Loading branch information
Owen Jones
committed
May 15, 2018
1 parent
ee73846
commit 9dee357
Showing
17 changed files
with
304 additions
and
41 deletions.
There are no files selected for viewing
Binary file added
BIN
+1.46 KB
regression/cbmc-java/phi-merge_uninitialized_values/PhiMergeUninitialized.class
Binary file not shown.
54 changes: 54 additions & 0 deletions
54
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
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
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
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
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
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. |
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
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. |
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.