aboutsummaryrefslogtreecommitdiff
path: root/contrib/bc/tests/fuzzing/bc_inputs1/array.bc
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bc/tests/fuzzing/bc_inputs1/array.bc')
-rwxr-xr-xcontrib/bc/tests/fuzzing/bc_inputs1/array.bc60
1 files changed, 60 insertions, 0 deletions
diff --git a/contrib/bc/tests/fuzzing/bc_inputs1/array.bc b/contrib/bc/tests/fuzzing/bc_inputs1/array.bc
new file mode 100755
index 000000000000..dac232804914
--- /dev/null
+++ b/contrib/bc/tests/fuzzing/bc_inputs1/array.bc
@@ -0,0 +1,60 @@
+#! /usr/bin/bc -q
+
+define z(a[]) {
+ for (i = 0; i < l; ++i) {
+ a[i]
+ }
+}
+
+define x(a[]) {
+
+ # Test for separate vars and arrays.
+ auto a
+
+ for (a = 0; a < l; ++a) {
+ a[a] = -a
+ }
+
+ z(a[])
+}
+
+define g(x[], y[]) {
+ return x[0] - y[0]
+}
+
+define h(y[], x[]) {
+ return g(x[], y[])
+}
+
+define m(*x[], *y[]) {
+ return x[0] / y[0]
+}
+
+define n(*y[], *x[]) {
+ return m(x[], y[])
+}
+
+for (i = 0; i < 101; ++i) {
+ a[i] = i
+}
+
+a[104] = 204
+
+l = length(a[])
+
+for (i = 0; i <= l; ++i) {
+ a[i]
+}
+
+z(a[])
+x(a[])
+z(a[])
+l
+
+x[0] = 5
+y[0] = 4
+
+h(x[], y[])
+n(x[], y[])
+
+halt