-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for local variable live ranges with holes
Both of these feature local variables that are declared in the class file LVT with two or more live ranges, because of initialisation by a try/catch or the cases of a switch statement. The tests assert that the initialisation is as expected, to catch cases where the two live ranges are erroneously treated seperately and so the variable read in the assertion is an effective nondet.
- Loading branch information
Showing
6 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
26 changes: 26 additions & 0 deletions
26
regression/cbmc-java/LocalVarTable3/live_range_with_holes.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,26 @@ | ||
|
||
public class live_range_with_holes { | ||
|
||
public static void main(int arg) { | ||
|
||
int x; | ||
int y; | ||
switch(arg) { | ||
case 1: | ||
x = 1; | ||
y = 1; | ||
break; | ||
case 2: | ||
x = 2; | ||
y = 2; | ||
break; | ||
default: | ||
x = 0; | ||
y = 0; | ||
break; | ||
} | ||
assert(x >= 0 && x <= 2); | ||
|
||
} | ||
|
||
} |
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,7 @@ | ||
CORE | ||
live_range_with_holes.class | ||
--function live_range_with_holes.main | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
-- |
Binary file not shown.
18 changes: 18 additions & 0 deletions
18
regression/cbmc-java/LocalVarTable4/live_range_exception.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,18 @@ | ||
|
||
public class live_range_exception { | ||
public static void main() { | ||
int x; | ||
int y; | ||
try | ||
{ | ||
x = 0; | ||
y = 0; | ||
} | ||
catch(Exception e) | ||
{ | ||
x = 1; | ||
y = 1; | ||
} | ||
assert(x==0 || x==1); | ||
} | ||
} |
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,7 @@ | ||
CORE | ||
live_range_exception.class | ||
--function live_range_exception.main | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
-- |