Volatile read of a `[u8; 8]` from MMIO returns `0`
⚓ Rust 📅 2026-04-04 👤 surdeus 👁️ 5In attempting to read a [u8; 8] from an MMIO register (to re-compose into a native u64 from little-endian bytes), the read_volatile seems to always return zero. However, when attempting to read a u64 it works fine. To my mind, reading 8 bytes as an array and reading 8 bytes as an integer should be equivalent.
What could be causing this?
EDIT: It appears that in release mode, the behaviour of read_volatile is much more clear here. It effectively translates to 8 1-byte reads, which are then re-composed into a single register. This is very weird to me.
12 posts - 4 participants
🏷️ Rust_feed