-
Notifications
You must be signed in to change notification settings - Fork 273
TG-1877: Include array pointer types in needed classes #1660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
smowton
merged 2 commits into
diffblue:develop
from
smowton:smowton/fix/lazy_methods_array_parameters
Jan 8, 2018
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains hidden or 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 | ||
test.class | ||
--lazy-methods --verbosity 10 --function test.g | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
elaborate java::test\.f:\(\)I | ||
VERIFICATION SUCCESSFUL |
22 changes: 22 additions & 0 deletions
22
regression/cbmc-java/lazyloading_array_parameter/test.java
This file contains hidden or 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,22 @@ | ||
|
||
public class test { | ||
|
||
public int f() { return 1; } | ||
|
||
public static void g(test[] args) { | ||
|
||
if(args == null || args.length != 1 || args[0] == null) | ||
return; | ||
asserthere.doassert(args[0].f() == 1); | ||
|
||
} | ||
|
||
} | ||
|
||
class asserthere { | ||
|
||
// Used to avoid lazy-loading currently marking any class with an | ||
// $assertionsEnabled member (i.e. any class that asserts) as needed. | ||
public static void doassert(boolean condition) { assert(condition); } | ||
|
||
} |
Binary file added
BIN
+506 Bytes
regression/cbmc-java/lazyloading_indirect_array_parameter/asserthere.class
Binary file not shown.
Binary file added
BIN
+218 Bytes
regression/cbmc-java/lazyloading_indirect_array_parameter/container.class
Binary file not shown.
Binary file added
BIN
+501 Bytes
regression/cbmc-java/lazyloading_indirect_array_parameter/test.class
Binary file not shown.
7 changes: 7 additions & 0 deletions
7
regression/cbmc-java/lazyloading_indirect_array_parameter/test.desc
This file contains hidden or 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 | ||
test.class | ||
--lazy-methods --verbosity 10 --function test.g | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
elaborate java::test\.f:\(\)I | ||
VERIFICATION SUCCESSFUL |
29 changes: 29 additions & 0 deletions
29
regression/cbmc-java/lazyloading_indirect_array_parameter/test.java
This file contains hidden or 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,29 @@ | ||
|
||
public class test { | ||
|
||
public int f() { return 1; } | ||
|
||
public static void g(container c) { | ||
|
||
if(c == null) | ||
return; | ||
test[] args = c.test_array; | ||
if(args == null || args.length != 1 || args[0] == null) | ||
return; | ||
asserthere.doassert(args[0].f() == 1); | ||
|
||
} | ||
|
||
} | ||
|
||
class container { | ||
public test[] test_array; | ||
} | ||
|
||
class asserthere { | ||
|
||
// Used to avoid lazy-loading currently marking any class with an | ||
// $assertionsEnabled member (i.e. any class that asserts) as needed. | ||
public static void doassert(boolean condition) { assert(condition); } | ||
|
||
} |
Binary file added
BIN
+597 Bytes
regression/cbmc-java/lazyloading_indirect_generic_array_parameter/asserthere.class
Binary file not shown.
Binary file added
BIN
+430 Bytes
regression/cbmc-java/lazyloading_indirect_generic_array_parameter/container.class
Binary file not shown.
Binary file added
BIN
+762 Bytes
regression/cbmc-java/lazyloading_indirect_generic_array_parameter/test.class
Binary file not shown.
7 changes: 7 additions & 0 deletions
7
regression/cbmc-java/lazyloading_indirect_generic_array_parameter/test.desc
This file contains hidden or 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 | ||
test.class | ||
--lazy-methods --verbosity 10 --function test.g | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
elaborate java::test\.f:\(\)I | ||
VERIFICATION SUCCESSFUL |
29 changes: 29 additions & 0 deletions
29
regression/cbmc-java/lazyloading_indirect_generic_array_parameter/test.java
This file contains hidden or 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,29 @@ | ||
|
||
public class test { | ||
|
||
public int f() { return 1; } | ||
|
||
public static void g(container<test> c) { | ||
|
||
if(c == null) | ||
return; | ||
test[] args = c.test_array; | ||
if(args == null || args.length != 1 || args[0] == null) | ||
return; | ||
asserthere.doassert(args[0].f() == 1); | ||
|
||
} | ||
|
||
} | ||
|
||
class container<T> { | ||
public T[] test_array; | ||
} | ||
|
||
class asserthere { | ||
|
||
// Used to avoid lazy-loading currently marking any class with an | ||
// $assertionsEnabled member (i.e. any class that asserts) as needed. | ||
public static void doassert(boolean condition) { assert(condition); } | ||
|
||
} |
Binary file added
BIN
+597 Bytes
regression/cbmc-java/lazyloading_multiple_generic_parameters/asserthere.class
Binary file not shown.
Binary file added
BIN
+453 Bytes
regression/cbmc-java/lazyloading_multiple_generic_parameters/container.class
Binary file not shown.
Binary file added
BIN
+800 Bytes
regression/cbmc-java/lazyloading_multiple_generic_parameters/test.class
Binary file not shown.
7 changes: 7 additions & 0 deletions
7
regression/cbmc-java/lazyloading_multiple_generic_parameters/test.desc
This file contains hidden or 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 | ||
test.class | ||
--lazy-methods --verbosity 10 --function test.g | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
elaborate java::test\.f:\(\)I | ||
VERIFICATION SUCCESSFUL |
29 changes: 29 additions & 0 deletions
29
regression/cbmc-java/lazyloading_multiple_generic_parameters/test.java
This file contains hidden or 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,29 @@ | ||
|
||
public class test { | ||
|
||
public int f() { return 1; } | ||
|
||
public static void g(container<Integer, test> c) { | ||
|
||
if(c == null) | ||
return; | ||
test[] args = c.test_array; | ||
if(args == null || args.length != 1 || args[0] == null) | ||
return; | ||
asserthere.doassert(args[0].f() == 1); | ||
|
||
} | ||
|
||
} | ||
|
||
class container<S, T> { | ||
public T[] test_array; | ||
} | ||
|
||
class asserthere { | ||
|
||
// Used to avoid lazy-loading currently marking any class with an | ||
// $assertionsEnabled member (i.e. any class that asserts) as needed. | ||
public static void doassert(boolean condition) { assert(condition); } | ||
|
||
} |
Binary file added
BIN
+506 Bytes
regression/cbmc-java/lazyloading_nested_generic_parameters/asserthere.class
Binary file not shown.
Binary file added
BIN
+308 Bytes
regression/cbmc-java/lazyloading_nested_generic_parameters/container.class
Binary file not shown.
Binary file added
BIN
+301 Bytes
regression/cbmc-java/lazyloading_nested_generic_parameters/container2.class
Binary file not shown.
Binary file added
BIN
+674 Bytes
regression/cbmc-java/lazyloading_nested_generic_parameters/test.class
Binary file not shown.
13 changes: 13 additions & 0 deletions
13
regression/cbmc-java/lazyloading_nested_generic_parameters/test.desc
This file contains hidden or 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,13 @@ | ||
KNOWNBUG | ||
test.class | ||
--lazy-methods --verbosity 10 --function test.g | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
elaborate java::test\.f:\(\)I | ||
VERIFICATION SUCCESSFUL | ||
-- | ||
-- | ||
The right methods are loaded, but verification is not successful | ||
because __CPROVER_start doesn't create appropriately typed input for | ||
this kind of nested generic parameter, so dynamic cast checks fail upon | ||
fetching the generic type's field. |
36 changes: 36 additions & 0 deletions
36
regression/cbmc-java/lazyloading_nested_generic_parameters/test.java
This file contains hidden or 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,36 @@ | ||
|
||
public class test { | ||
|
||
public int f() { return 1; } | ||
|
||
public static void g(container2<container<test>> c) { | ||
|
||
if(c == null) | ||
return; | ||
container<test> outer = c.next; | ||
if(outer == null) | ||
return; | ||
test[] args = outer.test_array; | ||
if(args == null || args.length != 1 || args[0] == null) | ||
return; | ||
asserthere.doassert(args[0].f() == 1); | ||
|
||
} | ||
|
||
} | ||
|
||
class container<T> { | ||
public T[] test_array; | ||
} | ||
|
||
class container2<T> { | ||
public T next; | ||
} | ||
|
||
class asserthere { | ||
|
||
// Used to avoid lazy-loading currently marking any class with an | ||
// $assertionsEnabled member (i.e. any class that asserts) as needed. | ||
public static void doassert(boolean condition) { assert(condition); } | ||
|
||
} |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reason behind using a separate class here rather than just calling
assert(args[0].f() == 1);
directly?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out lazy loading always marks classes that make assertions as needed! I'm not sure why, I certainly didn't write that code, but I didn't want to meddle with it for now...