Hacker News new | past | comments | ask | show | jobs | submit login

It looks to me like they're turned into the appropriate Rust intrinsic.

Do you have an example where the read vanishes?

Notice that it's very easy for C programmers to write code they think is performing a volatile read, but isn't, whereas obviously the intrinsics reduce the scope for this error in the Rust (it is also, though that's not relevant here, easy to write C code that depends on imaginary semantics of volatile access and so the code doesn't actually always work, or it works but not for the reason the programmer expected)




If you believe there is no volatile read in this code, I'd like to understand why.

    void func(volatile unsigned *a) { *a; }


Nope, I agree that's a volatile read, and indeed the web page doesn't emit the appropriate intrinsic, nor indeed do small modifications that result in a read of the pointer, cause the intrinsic to be used as I'd anticipated.

Definitely something to be wary of. I assure you the c2rust source code does know about volatile access and Rust's intrinsics (I was looking at that code for other reasons), so if you work with this stuff I'd encourage talking to the people who wrote it to find out what the situation is.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: