-
Notifications
You must be signed in to change notification settings - Fork 357
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
NumericValueChecker incorrectly reports out-of-range error #493
Comments
I think the problem is in the
Error :
|
Hi, |
I am running this on a Windows 11 and OpenJDK version "11.0.24" |
Can you please make a branch with your changes on a forked repo and provide me with the exact command to reproduce the bug? Perhaps it's floating-point (and hardware) dependent, perhaps not. |
I am running this test using Intellij but if you run the command
By the way when I am using the |
Without I could reproduce the result now, so it is not a floating point issue. I copy the full unit test code for reference below, as the code above lacked the package and import declarations. package gov.nasa.jpf.test.mc.data;
import gov.nasa.jpf.util.TypeRef;
import gov.nasa.jpf.util.test.TestJPF;
import org.junit.Test;
public class NumericTest extends TestJPF {
static class C2 {
void doSomething() {
double x = 0.5;
}
}
@org.junit.Test
public void testVars() {
if (verifyNoPropertyViolation("+listener=.listener.NumericValueChecker",
"+range.vars=x",
"+range.x.var=*$C2.doSomething():x",
"+range.x.max=0.9")) {
C2 c2 = new C2();
c2.doSomething();
}
}
} |
The problem lies in line 72 :
the max value ( 0.9 ) is not used to check the condition rather the value (0.0) is used so the condition ( 0.5 > 0.0) becomes true if the type conversion is not used then the test is passing. |
Yes, I have just adapted the test and found the reason, too. I've pushed a fix to a branch and will merge it once CI has completed. |
So is the type conversion a mistake there or was there a purpose doing it ? |
It was a copy/paste mistake (at least that's what it looks like). I've indicated as much in my commit message. |
I encountered an issue with
NumericValueChecker
inJDK 11
, where it incorrectly reports a variable as out of range, even though the variable's value is clearly within the specified range. This behavior seems like a bug, but I'm not quite sure.Could you please clarify if this is a bug? Or is there something wrong with my usage?
Test Code Example:
The
NumericValueChecker
should verify that the local variablex
in methoddoSomething
is within the specified range (i.e.,x <= 0.9
). Since the value ofx
is 0.5 , no error is expected to be reported. But it reported an error (0.500000 > 0.900000):Error Message:
The text was updated successfully, but these errors were encountered: