Skip to content

Commit 784b6dd

Browse files
author
Daniel Kroening
authored
Merge pull request diffblue#2119 from svorenova/gs_tg1121_regression
Adding regression tests for multi-dimensional arrays [TG-1121]
2 parents 1b6a939 + 227e83d commit 784b6dd

20 files changed

+157
-0
lines changed
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
public class A {
2+
public float a;
3+
}
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
public class FloatMultidim1 {
2+
public float[][] f(int y) {
3+
if (y > 0 && y < 5) {
4+
float[][] a1 = new float[y][2];
5+
int j;
6+
if (y > 1) {
7+
j = 1;
8+
} else {
9+
j = 0;
10+
}
11+
a1[j][1] = 1.0f;
12+
return a1;
13+
} else {
14+
return null;
15+
}
16+
}
17+
}
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
public class FloatMultidim2 {
2+
public float[][] f(int y) {
3+
if (y > 0 && y < 5) {
4+
float[][] a1 = new float[2][y];
5+
int j;
6+
if (y > 1) {
7+
j = 1;
8+
} else {
9+
j = 0;
10+
}
11+
a1[1][j] = 1.0f;
12+
return a1;
13+
} else {
14+
return new float[1][1];
15+
}
16+
}
17+
}
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
public class RefMultidim1 {
2+
public A[][] f(int y) {
3+
if (y > 0 && y < 5) {
4+
A[][] a1 = new A[y][2];
5+
int j;
6+
if (y > 1) {
7+
j = 1;
8+
} else {
9+
j = 0;
10+
}
11+
a1[j][1] = new A();
12+
a1[j][1].a = 1.0f;
13+
return a1;
14+
} else {
15+
return null;
16+
}
17+
}
18+
}
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
public class RefMultidim2 {
2+
public A[][] f(int y) {
3+
if (y > 0 && y < 5) {
4+
A[][] a1 = new A[2][y];
5+
int j;
6+
if (y > 1) {
7+
j = 1;
8+
} else {
9+
j = 0;
10+
}
11+
a1[1][j] = new A();
12+
a1[1][j].a = 1.0f;
13+
return a1;
14+
} else {
15+
return null;
16+
}
17+
}
18+
}
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
public class RefMultidimConstsize {
2+
public void f(int y) {
3+
A[][] a1 = new A[2][2];
4+
int j = 1;
5+
a1[j][1] = new A();
6+
a1[j][1].a = 1.0f;
7+
}
8+
}
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
public class RefSingledim {
2+
public A[] f(int y) {
3+
if (y > 0 && y < 5) {
4+
A[] a1 = new A[y];
5+
int j;
6+
if (y > 1) {
7+
j = 1;
8+
} else {
9+
j = 0;
10+
}
11+
a1[j] = new A();
12+
a1[j].a = 1.0f;
13+
return a1;
14+
} else {
15+
return null;
16+
}
17+
}
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
KNOWNBUG
2+
FloatMultidim1.class
3+
--function FloatMultidim1.f --cover location --unwind 3
4+
\d+ of \d+ covered
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
--
9+
This crashes during symex, with error 'cannot unpack array of nonconst size'
10+
when trying to access the element of the array. Symex uses byte_extract_little
11+
_endian to access the element which does not get simplified (it seems the
12+
problem is that the types in the instruction do not match). TG-1121
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
FloatMultidim2.class
3+
--function FloatMultidim2.f --cover location --unwind 3
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
y=1$
7+
y=[2-4]$
8+
y=([05-9]|[1-9][0-9]+|-[1-9][0-9]*)$
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
KNOWNBUG
2+
RefMultidim1.class
3+
--function RefMultidim1.f --cover location --unwind 3
4+
\d+ of \d+ covered
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
--
9+
This crashes during symex, with error 'cannot unpack array of nonconst size'
10+
when trying to access the element of the array. Symex uses byte_extract_little
11+
_endian to access the element which does not get simplified (it seems the
12+
problem is that the types in the instruction do not match). TG-1121
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
KNOWNBUG
2+
RefMultidim2.class
3+
--function RefMultidim2.f --cover location --unwind 3
4+
\d+ of \d+ covered
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
--
9+
This crashes during symex, with error 'cannot unpack array of nonconst size'
10+
when trying to access the element of the array. Symex uses byte_extract_little
11+
_endian to access the element which does not get simplified (it seems the
12+
problem is that the types in the instruction do not match). TG-1121
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
RefMultidimConstsize.class
3+
--function RefMultidimConstsize.f --cover location --unwind 3
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
y=-*[0-9]+$
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
RefSingledim.class
3+
--function RefSingledim.f --cover location --unwind 3
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
y=1$
7+
y=[2-4]$
8+
y=([05-9]|[1-9][0-9]+|-[1-9][0-9]*)$

0 commit comments

Comments
 (0)