• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1SKIP: FAILED
2
3vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl:71:7 warning: code is unreachable
4      return;
5      ^^^^^^
6
7vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl:94:7 warning: code is unreachable
8      return;
9      ^^^^^^
10
11vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl:96:5 warning: code is unreachable
12    return;
13    ^^^^^^
14
15struct BST {
16  int data;
17  int leftIndex;
18  int rightIndex;
19};
20struct QuicksortObject {
21  int numbers[10];
22};
23
24static QuicksortObject obj = (QuicksortObject)0;
25static BST tree[10] = (BST[10])0;
26cbuffer cbuffer_x_50 : register(b0, space0) {
27  uint4 x_50[1];
28};
29static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
30
31void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST node, inout int data) {
32  const int x_208 = data;
33  node.data = x_208;
34  node.leftIndex = -1;
35  node.rightIndex = -1;
36  return;
37}
38
39void insert_i1_i1_(inout int treeIndex, inout int data_1) {
40  int baseIndex = 0;
41  BST param = (BST)0;
42  int param_1 = 0;
43  BST param_2 = (BST)0;
44  int param_3 = 0;
45  baseIndex = 0;
46  [loop] while (true) {
47    const int x_217 = baseIndex;
48    const int x_218 = treeIndex;
49    if ((x_217 <= x_218)) {
50    } else {
51      break;
52    }
53    const int x_221 = data_1;
54    const int x_224 = tree[baseIndex].data;
55    if ((x_221 <= x_224)) {
56      const int x_231 = tree[baseIndex].leftIndex;
57      if ((x_231 == -1)) {
58        const int x_236 = baseIndex;
59        const int x_237 = treeIndex;
60        tree[x_236].leftIndex = x_237;
61        const int x_239 = treeIndex;
62        const BST x_241 = tree[x_239];
63        param = x_241;
64        const int x_242 = data_1;
65        param_1 = x_242;
66        makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1);
67        tree[x_239] = param;
68        return;
69      } else {
70        const int x_248 = tree[baseIndex].leftIndex;
71        baseIndex = x_248;
72        continue;
73      }
74      return;
75    } else {
76      const int x_251 = tree[baseIndex].rightIndex;
77      if ((x_251 == -1)) {
78        const int x_256 = baseIndex;
79        const int x_257 = treeIndex;
80        tree[x_256].rightIndex = x_257;
81        const int x_259 = treeIndex;
82        const BST x_261 = tree[x_259];
83        param_2 = x_261;
84        const int x_262 = data_1;
85        param_3 = x_262;
86        makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3);
87        tree[x_259] = param_2;
88        return;
89      } else {
90        const int x_268 = tree[baseIndex].rightIndex;
91        baseIndex = x_268;
92        continue;
93      }
94      return;
95    }
96    return;
97  }
98  return;
99}
100
101int identity_i1_(inout int a) {
102  const int x_202 = a;
103  const int x_203 = a;
104  obj.numbers[x_202] = x_203;
105  const int x_206 = obj.numbers[2];
106  return x_206;
107}
108
109int search_i1_(inout int target) {
110  int index = 0;
111  BST currentNode = (BST)0;
112  int x_270 = 0;
113  index = 0;
114  [loop] while (true) {
115    if ((index != -1)) {
116    } else {
117      break;
118    }
119    const BST x_280 = tree[index];
120    currentNode = x_280;
121    const int x_282 = currentNode.data;
122    const int x_283 = target;
123    if ((x_282 == x_283)) {
124      const int x_287 = target;
125      return x_287;
126    }
127    const int x_288 = target;
128    const int x_290 = currentNode.data;
129    if ((x_288 > x_290)) {
130      const int x_296 = currentNode.rightIndex;
131      x_270 = x_296;
132    } else {
133      const int x_298 = currentNode.leftIndex;
134      x_270 = x_298;
135    }
136    index = x_270;
137  }
138  return -1;
139}
140
141void main_1() {
142  int treeIndex_1 = 0;
143  BST param_4 = (BST)0;
144  int param_5 = 0;
145  int param_6 = 0;
146  int param_7 = 0;
147  int param_8 = 0;
148  int param_9 = 0;
149  int param_10 = 0;
150  int param_11 = 0;
151  int param_12 = 0;
152  int param_13 = 0;
153  int param_14 = 0;
154  int param_15 = 0;
155  int param_16 = 0;
156  int param_17 = 0;
157  int param_18 = 0;
158  int param_19 = 0;
159  int param_20 = 0;
160  int param_21 = 0;
161  int param_22 = 0;
162  int param_23 = 0;
163  int pp = 0;
164  int looplimiter0 = 0;
165  int i = 0;
166  int param_24 = 0;
167  int count = 0;
168  int i_1 = 0;
169  int result = 0;
170  int param_25 = 0;
171  treeIndex_1 = 0;
172  const BST x_101 = tree[0];
173  param_4 = x_101;
174  param_5 = 9;
175  makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5);
176  tree[0] = param_4;
177  treeIndex_1 = (treeIndex_1 + 1);
178  param_6 = treeIndex_1;
179  param_7 = 5;
180  insert_i1_i1_(param_6, param_7);
181  treeIndex_1 = (treeIndex_1 + 1);
182  param_8 = treeIndex_1;
183  param_9 = 12;
184  insert_i1_i1_(param_8, param_9);
185  treeIndex_1 = (treeIndex_1 + 1);
186  param_10 = treeIndex_1;
187  param_11 = 15;
188  insert_i1_i1_(param_10, param_11);
189  treeIndex_1 = (treeIndex_1 + 1);
190  param_12 = treeIndex_1;
191  param_13 = 7;
192  insert_i1_i1_(param_12, param_13);
193  treeIndex_1 = (treeIndex_1 + 1);
194  param_14 = treeIndex_1;
195  param_15 = 8;
196  insert_i1_i1_(param_14, param_15);
197  treeIndex_1 = (treeIndex_1 + 1);
198  param_16 = treeIndex_1;
199  param_17 = 2;
200  insert_i1_i1_(param_16, param_17);
201  treeIndex_1 = (treeIndex_1 + 1);
202  param_18 = treeIndex_1;
203  param_19 = 6;
204  insert_i1_i1_(param_18, param_19);
205  treeIndex_1 = (treeIndex_1 + 1);
206  param_20 = treeIndex_1;
207  param_21 = 17;
208  insert_i1_i1_(param_20, param_21);
209  treeIndex_1 = (treeIndex_1 + 1);
210  param_22 = treeIndex_1;
211  param_23 = 13;
212  insert_i1_i1_(param_22, param_23);
213  pp = 0;
214  looplimiter0 = 0;
215  i = 0;
216  {
217    [loop] for(; (i < 10000); i = (i + 1)) {
218      const int x_148 = looplimiter0;
219      const float x_150 = asfloat(x_50[0].y);
220      if ((x_148 >= int(x_150))) {
221        const float x_156 = asfloat(x_50[0].y);
222        param_24 = (1 + int(x_156));
223        const int x_159 = identity_i1_(param_24);
224        pp = x_159;
225        break;
226      }
227      looplimiter0 = (looplimiter0 + 1);
228    }
229  }
230  if ((pp != 2)) {
231    return;
232  }
233  count = 0;
234  i_1 = 0;
235  {
236    [loop] for(; (i_1 < 20); i_1 = (i_1 + 1)) {
237      param_25 = i_1;
238      const int x_176 = search_i1_(param_25);
239      result = x_176;
240      switch(i_1) {
241        case 2:
242        case 5:
243        case 6:
244        case 7:
245        case 8:
246        case 9:
247        case 12:
248        case 13:
249        case 15:
250        case 17: {
251          if ((result == i_1)) {
252            count = (count + 1);
253          }
254          break;
255        }
256        default: {
257          if ((result == -1)) {
258            count = (count + 1);
259          }
260          break;
261        }
262      }
263    }
264  }
265  if ((count == 20)) {
266    x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
267  } else {
268    x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f);
269  }
270  return;
271}
272
273struct main_out {
274  float4 x_GLF_color_1;
275};
276struct tint_symbol {
277  float4 x_GLF_color_1 : SV_Target0;
278};
279
280main_out main_inner() {
281  main_1();
282  const main_out tint_symbol_2 = {x_GLF_color};
283  return tint_symbol_2;
284}
285
286tint_symbol main() {
287  const main_out inner_result = main_inner();
288  tint_symbol wrapper_result = (tint_symbol)0;
289  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
290  return wrapper_result;
291}
292C:\src\tint\test\Shader@0x00000219E1FE81C0(32,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
293C:\src\tint\test\Shader@0x00000219E1FE81C0(203,12-42): error X3531: can't unroll loops marked with loop attribute
294
295