Wow, seems like I stumbled on a high priority soundness bug in the compiler that is not actually anything to do with any asm. Nice I could contribute a little something to the Rust project.
That's actually big difference between C culture and Rust culture.
In a C world (especially in embedded) I saw some really horrible hacks designed to work around some exotic bugs in a compiler – yet people rarely report them.
Because there are no point in doing that: vendors give you some compiler based on decade old GCC (today they have switched to five years old clang… big progress!) and even if you report a bug… it may take 10 or 20 years before you may remove your kludge.
With Rust's “living at the ToT” way of doing things “reporting and fixing bug” activity is actually useful for the reporter.
P.S. This being said, you still have to keep in mind that for 100 times when you think… “no, that's not possible, there are something wrong with the compiler…” 99 times it's your fault, 1 time it's the compiler bug. Verify your “compiler bugs” carefully before reporting them, there are no need to clog the bug-reporting pipes with bugs that are not bugs.
Oh my God, so true. Back in the day it was mandated that our project will use WindRiver's VxWorks operating system. Because, you know, "safety critical", certifications, standards, "they use it on Mars" and all that. Well the GCC shipped with VxWorks crashed while compiling my code, which gave me little confidence in what it might generate. After suffering that and numerous other problems I managed to get permission to switch to Linux. Life was good and that system is still running all over Scandinavia fifteen years later.
Indeed, finding a compiler bug is amazingly rare. It's almost always my fault. So it was very helpful to have the discussion about it here first.