dfa: IDEA-146950 "<" expr is always false but "<=" is not

This commit is contained in:
peter
2015-10-28 14:02:36 +01:00
parent 4a39ccd114
commit 27271e9979
2 changed files with 9 additions and 2 deletions
@@ -549,10 +549,12 @@ public class StandardInstructionVisitor extends InstructionVisitor {
if (opSign == LT && comparedWith <= rangeMin) return alwaysFalse(instruction, runner, memState);
if (opSign == LT && comparedWith > rangeMax) return alwaysTrue(instruction, runner, memState);
if (opSign == LE && comparedWith >= rangeMax) return alwaysTrue(instruction, runner, memState);
if (opSign == LE && comparedWith < rangeMin) return alwaysFalse(instruction, runner, memState);
if (opSign == GT && comparedWith >= rangeMax) return alwaysFalse(instruction, runner, memState);
if (opSign == GT && comparedWith < rangeMin) return alwaysTrue(instruction, runner, memState);
if (opSign == GE && comparedWith <= rangeMin) return alwaysTrue(instruction, runner, memState);
if (opSign == GE && comparedWith > rangeMax) return alwaysFalse(instruction, runner, memState);
return null;
}
@@ -1,5 +1,3 @@
import java.util.Arrays;
class Test {
int[] mIndex = null;
int mSize = 0;
@@ -13,4 +11,11 @@ class Test {
mIndex[0] = -1;
}
void bar() {
int time = 99;
String str = <warning descr="Condition 'time < 0' is always 'false'">time < 0</warning> ? "" : "";
String str1 = <warning descr="Condition 'time <= 0' is always 'false'">time <= 0</warning> ? "" : "";
String str2 = <warning descr="Condition 'time >= 100' is always 'false'">time >= 100</warning> ? "" : "";
}
}