mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
DFA: Fix array flushing on assignment special case (unknown = unknown)
This commit is contained in:
+1
@@ -59,6 +59,7 @@ public class StandardInstructionVisitor extends InstructionVisitor {
|
||||
}
|
||||
if (dfaSource == dfaDest) {
|
||||
memState.push(dfaDest);
|
||||
flushArrayOnUnknownAssignment(instruction, runner.getFactory(), dfaDest, memState);
|
||||
return nextInstruction(instruction, runner, memState);
|
||||
}
|
||||
if (!(dfaDest instanceof DfaVariableValue &&
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
public class TwoArraysDiff {
|
||||
public void test(Iterable<String> net) {
|
||||
final int size = 3;
|
||||
final double[] d1 = new double[size];
|
||||
int count = 0;
|
||||
for (String s : net) {
|
||||
d1[count++] = calculate();
|
||||
}
|
||||
final double[] d2 = new double[size];
|
||||
count = 0;
|
||||
for (String s : net) {
|
||||
d2[count++] = calculate();
|
||||
}
|
||||
for (int i = 0; i < size; i++) {
|
||||
assertTrue(d2[i] < d1[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void assertTrue(boolean b) {
|
||||
if (!b) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
|
||||
native double calculate();
|
||||
}
|
||||
+1
@@ -57,4 +57,5 @@ public class DataFlowRangeAnalysisTest extends DataFlowInspectionTestCase {
|
||||
public void testBoxedRanges() { doTest(); }
|
||||
public void testLongRangeDiff() { doTest(); }
|
||||
public void testAlgebraic() { doTest(); }
|
||||
public void testTwoArraysDiff() { doTest(); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user