You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My previous manual translation of this was unsafe { ::core::ptr::read_volatile(&bindgen_generated_symbols::sched_active_pid) }. When translating with c2rust transpile comile_commands.json --preserve-unused-functions --emit-modules --emit-no-std (using #291), I get
which, in my understanding, allows the compiler to mush together multiple calls in a single function. That's not particularly bad for get_pid (which won't change in code that the Rust compiler will see as contiguous), but other functions will depend on the read to be volatile.
(I'm not fuly sure whether that's a bug in C2Rust, me expecting things it can't know or just the lack of a flag, but after looking through the docs and existing issues, I'm hoping for the former).
The text was updated successfully, but these errors were encountered:
kkysen
changed the title
Reads to volatiles are not mapped to read_volatile
Reads to volatiles are not mapped to read_volatileJun 29, 2022
The RIOT-OS code base I'm translating as part of the efforts around rust-lang/rust-bindgen#1344 contains a function like
My previous manual translation of this was
unsafe { ::core::ptr::read_volatile(&bindgen_generated_symbols::sched_active_pid) }
. When translating withc2rust transpile comile_commands.json --preserve-unused-functions --emit-modules --emit-no-std
(using #291), I getwhich, in my understanding, allows the compiler to mush together multiple calls in a single function. That's not particularly bad for get_pid (which won't change in code that the Rust compiler will see as contiguous), but other functions will depend on the read to be volatile.
(I'm not fuly sure whether that's a bug in C2Rust, me expecting things it can't know or just the lack of a flag, but after looking through the docs and existing issues, I'm hoping for the former).
The text was updated successfully, but these errors were encountered: