| // Expect 15 errors |
| |
| void loop_length_128() { for (int i = 0; i < 128; i++) {} } // OK, under kLoopTerminationLimit |
| void loop_length_129() { for (int i = 0; i < 129; i++) {} } // OK, under kLoopTerminationLimit |
| void loop_length_99999() { for (int i = 0; i < 99999; i++) {} } // OK, under kLoopTerminationLimit |
| void loop_length_100000() { for (int i = 0; i < 100000; i++) {} } |
| void infinite_loop1() { for (int i = 0; i < 1; i += 0) {} } |
| void infinite_loop2() { for (int i = 3; i >= 3; i += 0) {} } |
| void infinite_loop3() { for (float i = 3; i >= 3; i += 1e-20) {} } |
| |
| void set(out int x) { x = 1; } |
| void inc(inout int x) { x++; } |
| |
| void index_modified() { for (int i = 0; i < 2; i++) { i++; } } |
| void index_out_param() { for (int i = 0; i < 1; i++) { set(i); } } |
| void index_inout_param() { for (int i = 0; i < 1; i++) { inc(i); } } |
| |
| void infinite_loop_le() { for (int i = 0; i <= 3; --i) {} } |
| void infinite_loop_lt() { for (int i = 0; i < 4; --i) {} } |
| void infinite_loop_ge() { for (int i = 3; i >= 0; ++i) {} } |
| void infinite_loop_gt() { for (int i = 3; i > -1; ++i) {} } |
| void infinite_loop_eq1() { for (int i = 0; i == 0; i-=0) {} } |
| void infinite_loop_eq2() { for (int i = 1; i == 1; i+=0) {} } |
| void infinite_loop_ne1() { for (int i = 0; i != 4; i--) {} } |
| void infinite_loop_ne2() { for (int i = 0; i != 4; i+=3) {} } |
| |
| /*%%* |
| loop must guarantee termination in fewer iterations |
| invalid loop expression |
| invalid loop expression |
| loop must guarantee termination in fewer iterations |
| loop index must not be modified within body of the loop |
| loop index must not be modified within body of the loop |
| loop index must not be modified within body of the loop |
| loop must guarantee termination in fewer iterations |
| loop must guarantee termination in fewer iterations |
| loop must guarantee termination in fewer iterations |
| loop must guarantee termination in fewer iterations |
| invalid loop expression |
| invalid loop expression |
| loop must guarantee termination in fewer iterations |
| loop must guarantee termination in fewer iterations |
| *%%*/ |