2021-09-04 18:44:19 +00:00
|
|
|
// Expect 15 errors
|
2021-01-12 22:15:30 +00:00
|
|
|
|
2021-09-07 15:43:51 +00:00
|
|
|
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
|
2021-09-04 18:44:19 +00:00
|
|
|
void loop_length_100000() { for (int i = 0; i < 100000; i++) {} }
|
2021-09-07 15:43:51 +00:00
|
|
|
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) {} }
|
2021-01-12 22:15:30 +00:00
|
|
|
|
|
|
|
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); } }
|
2021-09-04 18:44:19 +00:00
|
|
|
|
|
|
|
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) {} }
|