Skip to content

Commit 6cb8a97

Browse files
author
svorenova
committed
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.
1 parent 7339638 commit 6cb8a97

20 files changed

+158
-0
lines changed
Binary file not shown.
Lines changed: 3 additions & 0 deletions
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.
Lines changed: 17 additions & 0 deletions
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.
Lines changed: 17 additions & 0 deletions
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.
Lines changed: 18 additions & 0 deletions
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.
Lines changed: 18 additions & 0 deletions
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+
}

0 commit comments

Comments
 (0)