Repository navigation
Encode NaN return values as \result != \result (JLiSA-Wit compatibility) - #4
Merged
Merged
Conversation
The function_return constraint for a NaN float/double return was
Float.isNaN(\result) / Double.isNaN(\result). JLiSA-Wit, the SV-COMP 2027
Java violation witness validator, reads a single value from the constraint
and accepts only \result == <literal> (incl. Float/Double.NaN and the
infinities), \result != \result and \result.equals("..."), so it could
not validate witnesses with a NaN return. \result != \result is exactly
NaN in Java semantics (unlike \result == Double.NaN, which is always
false) and passes WitnessLint. Other encodings are unchanged.
Bump the version to 1.1.1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sv-witnesses master (2.4.1-dev) rejects violation witnesses without a target waypoint, which the default-violation tests write on purpose. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
function_returnconstraints for a NaNfloat/doublereturn were rendered asFloat.isNaN(\result)/Double.isNaN(\result). They are now\result != \result. All other encodings are unchanged; the input contract is untouched. Version bumped to 1.1.1.Why
JLiSA-Wit (SV-COMP 2027 Java violation witness validator, Zenodo 24103125, commit 98fc3130) reads one value from the constraint in
ReturnConstraint.value. It accepts only\result == <literal>(includingFloat/Double.NaNand the infinities),\result != \result(as NaN) and\result.equals("..."). AnyisNaN(...)form gives "Could not validate". Of the forms it accepts,\result != \resultis the only one that is right in Java:\result == Double.NaNis always false. ItsForceReturnSteererturns the NaN into the method'sfloatordoublereturn type.Verification
test_literals,test_e2e::test_float_special_values, which also runs WitnessLint on the NaN witness).isNaN(\result)and ran them through the archived JLiSA-Wit binary with the official command lines:Could not validate | UNKNOWN, the same as the official runWitness Correct | FALSE\result == 0.5):Witness Spurious | TRUENot changed
Long.MIN_VALUEstays\result == -9223372036854775808L, which is valid Java. The archived validator overflows on it because it negates afterLong.decodeof the magnitude. Upstream fixed this in 17de2811. No other literal spelling (hex, octal) gets past that old parser, so there is no safe workaround.Integer.MIN_VALUE(\result == -2147483648) parses fine.Note
5 tests in
test_e2e(test_default_violation_lints[*],test_no_target_warns_but_writes) fail with the current sv-witnesses master linter, which reports a schema mismatch for witnesses without a target waypoint. They fail the same way onmain, so this PR does not cause them.🤖 Generated with Claude Code