aboutsummaryrefslogtreecommitdiff
path: root/tests/programs/bounds_prover.zc
blob: 1b3e3ca06d694d6bd043b2bee8b692d09c6c558d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
namespace;
include rt;

// the new loop proofs drop checks that cannot fail and keep the ones that can:
// the last loop runs one past a block of 6 and has to fault there.
int main() {
	int i, k, s = 0;
	fixed int[?] a = rt.new(fixed int[?], 8);
	fixed int[?] m = rt.new(fixed int[?], 16);
	fixed int[?] c = rt.new(fixed int[?], 6);
	for (i = 0; i < len(a); i++) a[i] = i;
	for (i = 0; i < len(a); i++) s = s + a[i];
	rt.put_n(s); rt.put_c(10);
	for (i = 0; i < 4; i++) for (k = 0; k < 4; k++) m[i * 4 + k] = i * k;
	s = 0; for (i = 0; i < len(m); i++) s = s + m[i];
	rt.put_n(s); rt.put_c(10);
	for (i = 0; i < 7; i++) { rt.put_n(i); rt.put_c(32); c[i] = i; }
	return 0;
}