3 ms·
> is the intent that miri could find much beyond what the sanitizers could? Miri serves two purposes. One of them is completely unrelated to this stuff, and th
by steveklabnik 8y ago
> is the intent that miri could find much beyond what the sanitizers could?
Miri serves two purposes. One of them is completely unrelated to this stuff, and that's to deal with const functions.
This stuff, on the other hand, yes. Those tools don't know anything about the language themselves. Miri is able to model the exact rules that we lay out for pointer usage. This means that it should be a lot better, not only at finding things, but also stuff like error messages, eventually.
> Regarding aligned accesses: does miri consider the alignment constraints of the most restrictive target? Or are there language specifications regarding alignment?
Because it's an interpreter, miri can run like any target. That said, I'm not 100% sure that 'cargo miri' exposes this easily yet; I gave it a shot but it's giving me an interesting error. The idea is that you'd specify the target you're testing for.
> To my uneducated eye, it looks like many/most of these defects that miri detects require unsafe to cause (barring compiler defects). Is that accurate?
Yes. Safe code should never produce undefined behavior, that's a hard design constraint of Rust.