https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82677
--- Comment #6 from infinity0 at pwned dot gg --- What I mean is, even if you do change GCC to fix the unintended optimisation, other projects' code are *still wrong* - it's only correct if you can assume the C compiler is optimising your code in a very specific way, that happens to safe for the specific sorts of "side effects" that div instructions do.