2021-01-12 22:15:30 +00:00
|
|
|
### Compilation failed:
|
|
|
|
|
2021-09-04 18:44:19 +00:00
|
|
|
error: 6: loop must guarantee termination in fewer iterations
|
2022-04-06 22:24:52 +00:00
|
|
|
void loop_length_100000() { for (int i = 0; i < 100000; i++) {} }
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2021-09-04 18:44:19 +00:00
|
|
|
error: 7: invalid loop expression
|
2022-04-06 22:24:52 +00:00
|
|
|
void infinite_loop1() { for (int i = 0; i < 1; i += 0) {} }
|
|
|
|
^^^^^^
|
2021-09-07 15:43:51 +00:00
|
|
|
error: 8: invalid loop expression
|
2022-04-06 22:24:52 +00:00
|
|
|
void infinite_loop2() { for (int i = 3; i >= 3; i += 0) {} }
|
|
|
|
^^^^^^
|
2021-09-07 15:43:51 +00:00
|
|
|
error: 9: loop must guarantee termination in fewer iterations
|
2022-04-06 22:24:52 +00:00
|
|
|
void infinite_loop3() { for (float i = 3; i >= 3; i += 1e-20) {} }
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2021-09-04 18:44:19 +00:00
|
|
|
error: 14: loop index must not be modified within body of the loop
|
2022-04-06 22:24:52 +00:00
|
|
|
void index_modified() { for (int i = 0; i < 2; i++) { i++; } }
|
2022-04-07 20:17:06 +00:00
|
|
|
^^^^^^^^
|
2021-09-07 15:43:51 +00:00
|
|
|
error: 15: loop index must not be modified within body of the loop
|
2022-04-06 22:24:52 +00:00
|
|
|
void index_out_param() { for (int i = 0; i < 1; i++) { set(i); } }
|
2022-04-07 20:17:06 +00:00
|
|
|
^^^^^^^^^^^
|
2021-09-07 15:43:51 +00:00
|
|
|
error: 16: loop index must not be modified within body of the loop
|
2022-04-06 22:24:52 +00:00
|
|
|
void index_inout_param() { for (int i = 0; i < 1; i++) { inc(i); } }
|
2022-04-07 20:17:06 +00:00
|
|
|
^^^^^^^^^^^
|
2021-09-04 18:44:19 +00:00
|
|
|
error: 18: loop must guarantee termination in fewer iterations
|
2022-04-06 22:24:52 +00:00
|
|
|
void infinite_loop_le() { for (int i = 0; i <= 3; --i) {} }
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2021-09-04 18:44:19 +00:00
|
|
|
error: 19: loop must guarantee termination in fewer iterations
|
2022-04-06 22:24:52 +00:00
|
|
|
void infinite_loop_lt() { for (int i = 0; i < 4; --i) {} }
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2021-09-07 15:43:51 +00:00
|
|
|
error: 20: loop must guarantee termination in fewer iterations
|
2022-04-06 22:24:52 +00:00
|
|
|
void infinite_loop_ge() { for (int i = 3; i >= 0; ++i) {} }
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2021-09-07 15:43:51 +00:00
|
|
|
error: 21: loop must guarantee termination in fewer iterations
|
2022-04-06 22:24:52 +00:00
|
|
|
void infinite_loop_gt() { for (int i = 3; i > -1; ++i) {} }
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2021-09-07 15:43:51 +00:00
|
|
|
error: 22: invalid loop expression
|
2022-04-06 22:24:52 +00:00
|
|
|
void infinite_loop_eq1() { for (int i = 0; i == 0; i-=0) {} }
|
|
|
|
^^^^
|
2021-09-07 15:43:51 +00:00
|
|
|
error: 23: invalid loop expression
|
2022-04-06 22:24:52 +00:00
|
|
|
void infinite_loop_eq2() { for (int i = 1; i == 1; i+=0) {} }
|
|
|
|
^^^^
|
2021-09-07 15:43:51 +00:00
|
|
|
error: 24: loop must guarantee termination in fewer iterations
|
2022-04-06 22:24:52 +00:00
|
|
|
void infinite_loop_ne1() { for (int i = 0; i != 4; i--) {} }
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2021-09-07 15:43:51 +00:00
|
|
|
error: 25: loop must guarantee termination in fewer iterations
|
2022-04-06 22:24:52 +00:00
|
|
|
void infinite_loop_ne2() { for (int i = 0; i != 4; i+=3) {} }
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2021-09-04 18:44:19 +00:00
|
|
|
15 errors
|