yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Yong HeAdd static for loop iteration inference. (#2659)8b05df418

master
2.1 KiB35 linesraw
1result code = 0
2standard error = {
3tests/diagnostics/for-loop-warning.slang(6): warning 30502: the for loop is modifiying variable 'i' in the opposite direction from loop exit condition.
4    for (int i = 0; i < x; i--) // warn.
5                            ^~
6tests/diagnostics/for-loop-warning.slang(10): warning 30503: the for loop is not modifiying variable 'j' because the step size evaluates to 0.
7    for (int j = 0; j < 3; j += 0) // warn.
8                             ^~
9tests/diagnostics/for-loop-warning.slang(14): warning 30500: the for loop initializes and checks variable 'j' but the side effect expression is modifying 'i'.
10        for (int j = 0; j < 3; i++) // warn.
11                               ^
12tests/diagnostics/for-loop-warning.slang(19): warning 30501: the for loop initializes and modifies variable 'j' but the predicate expression is checking 'i'.
13        for (int j = 0; i < 4; j++) // warn.
14                          ^
15tests/diagnostics/for-loop-warning.slang(42): warning 30505: the loop runs for 0 iterations and will be removed.
16    for (int i = 1; i < 0; i++) // warn
17    ^~~
18tests/diagnostics/for-loop-warning.slang(45): warning 30505: the loop runs for 0 iterations and will be removed.
19    for (int i = 1; i >= 2; i--) // warn
20    ^~~
21tests/diagnostics/for-loop-warning.slang(51): warning 30505: the loop runs for 0 iterations and will be removed.
22    for (int i = 1; i > 1; i--) // warn
23    ^~~
24tests/diagnostics/for-loop-warning.slang(23): warning 30504: the for loop is statically determined to terminate within 3 iterations, which is less than what [MaxIters] specifies.
25    [MaxIters(6)] // warn
26     ^~~~~~~~
27tests/diagnostics/for-loop-warning.slang(28): warning 30504: the for loop is statically determined to terminate within 2 iterations, which is less than what [MaxIters] specifies.
28    [MaxIters(6)] // warn
29     ^~~~~~~~
30tests/diagnostics/for-loop-warning.slang(32): warning 30504: the for loop is statically determined to terminate within 5 iterations, which is less than what [MaxIters] specifies.
31    [MaxIters(6)] // warn
32     ^~~~~~~~
33}
34standard output = {
35}