-
Notifications
You must be signed in to change notification settings - Fork 275
[TG-1940] Fix Java ternary-compare against NaN #1788
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
Merged
Changes from all commits
Commits
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.
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,20 @@ | ||
CORE | ||
test.class | ||
|
||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
assertion at file test.java line 37 .*: FAILURE | ||
assertion at file test.java line 45 .*: FAILURE | ||
assertion at file test.java line 49 .*: FAILURE | ||
assertion at file test.java line 53 .*: FAILURE | ||
assertion at file test.java line 57 .*: FAILURE | ||
assertion at file test.java line 41 .*: SUCCESS | ||
assertion at file test.java line 61 .*: FAILURE | ||
assertion at file test.java line 69 .*: FAILURE | ||
assertion at file test.java line 73 .*: FAILURE | ||
assertion at file test.java line 77 .*: FAILURE | ||
assertion at file test.java line 81 .*: FAILURE | ||
assertion at file test.java line 65 .*: SUCCESS | ||
-- | ||
^warning: ignoring |
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,84 @@ | ||
public class test { | ||
|
||
public static void main(int nondet) { | ||
|
||
float nan = 0.0f / 0.0f; | ||
float one = 1.0f; | ||
double nand = 0.0 / 0.0; | ||
double oned = 1.0; | ||
|
||
if(nondet == 1) | ||
checkeq(one, nan); | ||
if(nondet == 2) | ||
checkneq(one, nan); | ||
if(nondet == 3) | ||
checkgt(one, nan); | ||
if(nondet == 4) | ||
checkgeq(one, nan); | ||
if(nondet == 5) | ||
checklt(one, nan); | ||
if(nondet == 6) | ||
checkleq(one, nan); | ||
if(nondet == 7) | ||
checkeq(oned, nand); | ||
if(nondet == 8) | ||
checkneq(oned, nand); | ||
if(nondet == 9) | ||
checkgt(oned, nand); | ||
if(nondet == 10) | ||
checkgeq(oned, nand); | ||
if(nondet == 11) | ||
checklt(oned, nand); | ||
else | ||
checkleq(oned, nand); | ||
} | ||
|
||
public static void checkeq(float arg1, float arg2) { | ||
assert arg1 == arg2; | ||
} | ||
|
||
public static void checkneq(float arg1, float arg2) { | ||
assert arg1 != arg2; | ||
} | ||
|
||
public static void checkgt(float arg1, float arg2) { | ||
assert arg1 > arg2; | ||
} | ||
|
||
public static void checkgeq(float arg1, float arg2) { | ||
assert arg1 >= arg2; | ||
} | ||
|
||
public static void checklt(float arg1, float arg2) { | ||
assert arg1 < arg2; | ||
} | ||
|
||
public static void checkleq(float arg1, float arg2) { | ||
assert arg1 <= arg2; | ||
} | ||
|
||
public static void checkeq(double arg1, double arg2) { | ||
assert arg1 == arg2; | ||
} | ||
|
||
public static void checkneq(double arg1, double arg2) { | ||
assert arg1 != arg2; | ||
} | ||
|
||
public static void checkgt(double arg1, double arg2) { | ||
assert arg1 > arg2; | ||
} | ||
|
||
public static void checkgeq(double arg1, double arg2) { | ||
assert arg1 >= arg2; | ||
} | ||
|
||
public static void checklt(double arg1, double arg2) { | ||
assert arg1 < arg2; | ||
} | ||
|
||
public static void checkleq(double arg1, double arg2) { | ||
assert arg1 <= arg2; | ||
} | ||
|
||
} |
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.
please also remove
const constant_exprt nan_expr(nan.to_expr());
as it's not used any more