Rust-GPU / Rust-CUDA

Ecosystem of libraries and tools for writing and executing fast GPU code fully in Rust.
Apache License 2.0
2.97k stars 112 forks source link

could not compile `ntapi` (lib) due to 2 previous errors. error[E0793]: reference to packed field is unaligned #120

Open CrackAnna opened 6 months ago

CrackAnna commented 6 months ago
error[E0793]: reference to packed field is unaligned --> C:\Users\liuyu.cargo\registry\src\mirrors.ustc.edu.cn-12df342d903acd47\ntapi-0.3.7\src\ntexapi.rs:2783:52 2783 tick_count.QuadPart_mut() = read_volatile(&(USER_SHARED_DATA).u.TickCountQuad); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
 = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
 = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned --> C:\Users\liuyu.cargo\registry\src\mirrors.ustc.edu.cn-12df342d903acd47\ntapi-0.3.7\src\ntexapi.rs:2807:25 2807 ((read_volatile(&(*USER_SHARED_DATA).u.TickCountQuad) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
 = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
 = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)