blob: da294111d98d0772c948492b775d5b0d574d26f8 [file] [log] [blame]
Antonio Maiorano08d92792024-01-11 20:51:50 +00001fn deref_const() {
2 var a : array<i32, 10>;
3 let p = &(a);
4 var b = (*(p))[0];
5 (*(p))[0] = 42;
6}
7
8fn no_deref_const() {
9 var a : array<i32, 10>;
10 let p = &(a);
11 var b = p[0];
12 p[0] = 42;
13}
14
15fn deref_let() {
16 var a : array<i32, 10>;
17 let p = &(a);
18 let i = 0;
19 var b = (*(p))[i];
20 (*(p))[0] = 42;
21}
22
23fn no_deref_let() {
24 var a : array<i32, 10>;
25 let p = &(a);
26 let i = 0;
27 var b = p[i];
28 p[0] = 42;
29}
30
31fn deref_var() {
32 var a : array<i32, 10>;
33 let p = &(a);
34 var i = 0;
35 var b = (*(p))[i];
36 (*(p))[0] = 42;
37}
38
39fn no_deref_var() {
40 var a : array<i32, 10>;
41 let p = &(a);
42 var i = 0;
43 var b = p[i];
44 p[0] = 42;
45}
46
47@compute @workgroup_size(1)
48fn main() {
49 deref_const();
50 no_deref_const();
51 deref_let();
52 no_deref_let();
53 deref_var();
54 no_deref_var();
55}