-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding regression tests for multi-dimensional arrays
Connected to TG-1121 - crash for multidim arrays with non-const size and non-const element access, and variations of the example.
- Loading branch information
1 parent
7339638
commit e8b2281
Showing
20 changed files
with
157 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
3 changes: 3 additions & 0 deletions
3
regression/cbmc-java/array_nonconstsize_nonconstaccess/A.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
public class A { | ||
public float a; | ||
} |
Binary file added
BIN
+508 Bytes
regression/cbmc-java/array_nonconstsize_nonconstaccess/FloatMultidim1.class
Binary file not shown.
17 changes: 17 additions & 0 deletions
17
regression/cbmc-java/array_nonconstsize_nonconstaccess/FloatMultidim1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 added
BIN
+510 Bytes
regression/cbmc-java/array_nonconstsize_nonconstaccess/FloatMultidim2.class
Binary file not shown.
17 changes: 17 additions & 0 deletions
17
regression/cbmc-java/array_nonconstsize_nonconstaccess/FloatMultidim2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 added
BIN
+555 Bytes
regression/cbmc-java/array_nonconstsize_nonconstaccess/RefMultidim1.class
Binary file not shown.
18 changes: 18 additions & 0 deletions
18
regression/cbmc-java/array_nonconstsize_nonconstaccess/RefMultidim1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 added
BIN
+555 Bytes
regression/cbmc-java/array_nonconstsize_nonconstaccess/RefMultidim2.class
Binary file not shown.
18 changes: 18 additions & 0 deletions
18
regression/cbmc-java/array_nonconstsize_nonconstaccess/RefMultidim2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 added
BIN
+525 Bytes
regression/cbmc-java/array_nonconstsize_nonconstaccess/RefMultidimConstsize.class
Binary file not shown.
10 changes: 10 additions & 0 deletions
10
regression/cbmc-java/array_nonconstsize_nonconstaccess/RefMultidimConstsize.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
public class RefMultidimConstsize { | ||
public void f(int y) { | ||
A[][] a1 = new A[2][2]; | ||
if (y > 0) { | ||
int j = 1; | ||
a1[j][1] = new A(); | ||
a1[j][1].a = 1.0f; | ||
} | ||
} | ||
} |
Binary file added
BIN
+544 Bytes
regression/cbmc-java/array_nonconstsize_nonconstaccess/RefSingledim.class
Binary file not shown.
18 changes: 18 additions & 0 deletions
18
regression/cbmc-java/array_nonconstsize_nonconstaccess/RefSingledim.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
regression/cbmc-java/array_nonconstsize_nonconstaccess/test_float_multidim_1.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
6 changes: 6 additions & 0 deletions
6
regression/cbmc-java/array_nonconstsize_nonconstaccess/test_float_multidim_2.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
CORE | ||
FloatMultidim2.class | ||
--function FloatMultidim2.f --cover location --unwind 3 | ||
\d+ of \d+ covered \(100\.0\%\) | ||
^EXIT=0$ | ||
^SIGNAL=0$ |
12 changes: 12 additions & 0 deletions
12
regression/cbmc-java/array_nonconstsize_nonconstaccess/test_ref_multidim_1.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
12 changes: 12 additions & 0 deletions
12
regression/cbmc-java/array_nonconstsize_nonconstaccess/test_ref_multidim_2.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
7 changes: 7 additions & 0 deletions
7
regression/cbmc-java/array_nonconstsize_nonconstaccess/test_ref_multidim_constsize.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CORE | ||
RefMultidimConstsize.class | ||
--function RefMultidimConstsize.f --cover location --unwind 3 | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
-- | ||
^\[java::RefMultidimConstsize\.f:\(I\)V.*\sFAILED$ |
7 changes: 7 additions & 0 deletions
7
regression/cbmc-java/array_nonconstsize_nonconstaccess/test_ref_singledim.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CORE | ||
RefSingledim.class | ||
--function RefSingledim.f --cover location --unwind 3 | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
-- | ||
^\[java::RefSingledim\.f:\(I\)\[LA;.*\sFAILED$ |