diff options
| author | 2026-10-14 15:58:58 +0330 | |
|---|---|---|
| committer | 2026-10-14 15:58:58 +0330 | |
| commit | d55b5fdf92a674a6495878f97a09e95bafdcba3f (patch) | |
| tree | e811149b65640a3e253e6ebdce41affddb53ac37 /tests/programs/zc0unbounded.zc | |
| parent | merge line tables (diff) | |
bounds checking: port agent/bounds-checking onto main 0879d0a; unbounded main in o3call, o3 tests expect no check, boundsrules, bounds_fixed, bounds_heap and zc0unbounded tests
Diffstat (limited to 'tests/programs/zc0unbounded.zc')
| -rw-r--r-- | tests/programs/zc0unbounded.zc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/programs/zc0unbounded.zc b/tests/programs/zc0unbounded.zc new file mode 100644 index 0000000..67c3ae0 --- /dev/null +++ b/tests/programs/zc0unbounded.zc @@ -0,0 +1,16 @@ +namespace; +include rt; + +// unbounded in all three places zc0 accepts it (and ignores): the unit, a +// function prefix and a statement. both compilers print the same. +unbounded; +int[4] a; +unbounded int get(int i) { return a[i]; } +int main() { + int i = 2, r = 0; + a[2] = 40; + unbounded r = get(i) + 2; + unbounded { r = r + a[i - 2]; } + rt.put_n(r); rt.put_c(10); + return 0; +} |
