corrode icon indicating copy to clipboard operation
corrode copied to clipboard

Use of possibly uninitialized reference(s)

Open ddugovic opened this issue 7 years ago • 0 comments

After translating api.c and renaming to src/main.rs, then with cargo run I observe:

   Compiling antichess-tree-server v0.1.0 (file:///home/dand/Desktop/antichess-tree-server)
error[E0381]: use of possibly uninitialized variable: `tree`
  --> src/main.rs:80:18
   |
80 |             &mut tree as (*mut tree),
   |                  ^^^^ use of possibly uninitialized `tree`

error[E0381]: use of possibly uninitialized variable: `result`
  --> src/main.rs:90:33
   |
90 |         query_result_clear(&mut result as (*mut query_result));
   |                                 ^^^^^^ use of possibly uninitialized `result`

error[E0381]: use of possibly uninitialized variable: `tree`
  --> src/main.rs:96:23
   |
96 |                  &mut tree as (*mut tree),
   |                       ^^^^ use of possibly uninitialized `tree`

error[E0381]: use of possibly uninitialized variable: `result`
  --> src/main.rs:99:23
   |
99 |                  &mut result as (*mut query_result)
   |                       ^^^^^^ use of possibly uninitialized `result`

error[E0381]: use of possibly uninitialized variable: `result`
   --> src/main.rs:104:37
    |
104 |              query_result_sort(&mut result as (*mut query_result));
    |                                     ^^^^^^ use of possibly uninitialized `result`

error[E0381]: use of possibly uninitialized variable: `result.num_children`
   --> src/main.rs:107:27
    |
107 |                  if !(i < result.num_children) {
    |                           ^^^^^^^^^^^^^^^^^^^ use of possibly uninitialized `result.num_children`

error[E0381]: use of possibly uninitialized variable: `result.movs[..]`
   --> src/main.rs:111:26
    |
111 |                  mov_uci(result.movs[i],uci.as_mut_ptr());
    |                          ^^^^^^^^^^^^^^ use of possibly uninitialized `result.movs[..]`

error[E0381]: use of possibly uninitialized variable: `uci`
   --> src/main.rs:111:41
    |
111 |                  mov_uci(result.movs[i],uci.as_mut_ptr());
    |                                         ^^^ use of possibly uninitialized `uci`

error[E0381]: use of possibly uninitialized variable: `uci`
   --> src/main.rs:112:50
    |
112 |                  printf((*b"%s %d\n\0").as_ptr(),uci.as_mut_ptr(),result.sizes[i]);
    |                                                  ^^^ use of possibly uninitialized `uci`

error[E0381]: use of possibly uninitialized variable: `result.sizes[..]`
   --> src/main.rs:112:67
    |
112 |                  printf((*b"%s %d\n\0").as_ptr(),uci.as_mut_ptr(),result.sizes[i]);
    |                                                                   ^^^^^^^^^^^^^^^ use of possibly uninitialized `result.sizes[..]`

error: aborting due to 10 previous errors

error: Could not compile `antichess-tree-server`.

To learn more, run the command again with --verbose.

ddugovic avatar Jul 15 '17 18:07 ddugovic