Skip to content
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

Adding regression tests for multi-dimensional arrays [TG-1121] #2119

Merged
merged 1 commit into from
May 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
3 changes: 3 additions & 0 deletions regression/cbmc-java/array_nonconstsize_nonconstaccess/A.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
public class A {
public float a;
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
public class FloatMultidim1 {
public float[][] f(int y) {
if (y > 0 && y < 5) {
float[][] a1 = new float[y][2];
int j;
if (y > 1) {
j = 1;
} else {
j = 0;
}
a1[j][1] = 1.0f;
return a1;
} else {
return null;
}
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
public class FloatMultidim2 {
public float[][] f(int y) {
if (y > 0 && y < 5) {
float[][] a1 = new float[2][y];
int j;
if (y > 1) {
j = 1;
} else {
j = 0;
}
a1[1][j] = 1.0f;
return a1;
} else {
return new float[1][1];
}
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
public class RefMultidim1 {
public A[][] f(int y) {
if (y > 0 && y < 5) {
A[][] a1 = new A[y][2];
int j;
if (y > 1) {
j = 1;
} else {
j = 0;
}
a1[j][1] = new A();
a1[j][1].a = 1.0f;
return a1;
} else {
return null;
}
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
public class RefMultidim2 {
public A[][] f(int y) {
if (y > 0 && y < 5) {
A[][] a1 = new A[2][y];
int j;
if (y > 1) {
j = 1;
} else {
j = 0;
}
a1[1][j] = new A();
a1[1][j].a = 1.0f;
return a1;
} else {
return null;
}
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
public class RefMultidimConstsize {
public void f(int y) {
A[][] a1 = new A[2][2];
int j = 1;
a1[j][1] = new A();
a1[j][1].a = 1.0f;
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
public class RefSingledim {
public A[] f(int y) {
if (y > 0 && y < 5) {
A[] a1 = new A[y];
int j;
if (y > 1) {
j = 1;
} else {
j = 0;
}
a1[j] = new A();
a1[j].a = 1.0f;
return a1;
} else {
return null;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
KNOWNBUG
FloatMultidim1.class
--function FloatMultidim1.f --cover location --unwind 3
\d+ of \d+ covered
^EXIT=0$
^SIGNAL=0$
--
--
This crashes during symex, with error 'cannot unpack array of nonconst size'
when trying to access the element of the array. Symex uses byte_extract_little
_endian to access the element which does not get simplified (it seems the
problem is that the types in the instruction do not match). TG-1121
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
FloatMultidim2.class
--function FloatMultidim2.f --cover location --unwind 3
^EXIT=0$
^SIGNAL=0$
y=1$
y=[2-4]$
y=([05-9]|[1-9][0-9]+|-[1-9][0-9]*)$
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
KNOWNBUG
RefMultidim1.class
--function RefMultidim1.f --cover location --unwind 3
\d+ of \d+ covered
^EXIT=0$
^SIGNAL=0$
--
--
This crashes during symex, with error 'cannot unpack array of nonconst size'
when trying to access the element of the array. Symex uses byte_extract_little
_endian to access the element which does not get simplified (it seems the
problem is that the types in the instruction do not match). TG-1121
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
KNOWNBUG
RefMultidim2.class
--function RefMultidim2.f --cover location --unwind 3
\d+ of \d+ covered
^EXIT=0$
^SIGNAL=0$
--
--
This crashes during symex, with error 'cannot unpack array of nonconst size'
when trying to access the element of the array. Symex uses byte_extract_little
_endian to access the element which does not get simplified (it seems the
problem is that the types in the instruction do not match). TG-1121
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CORE
RefMultidimConstsize.class
--function RefMultidimConstsize.f --cover location --unwind 3
^EXIT=0$
^SIGNAL=0$
y=-*[0-9]+$
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
RefSingledim.class
--function RefSingledim.f --cover location --unwind 3
^EXIT=0$
^SIGNAL=0$
y=1$
y=[2-4]$
y=([05-9]|[1-9][0-9]+|-[1-9][0-9]*)$