3 ms·
Yes, the C and C++ standards allow compilers to eliminate loops which have no side effects (It's actually slightly more tricky than this but whatever, check the
by steveklabnik 9y ago
Yes, the C and C++ standards allow compilers to eliminate loops which have no side effects (It's actually slightly more tricky than this but whatever, check the spec for the exact details). This can be tough in situations like you say, but also in other places: for example, Rust's semantics do not allow you to elide them, but because we use LLVM, we incidentally inherited this behavior: https://github.com/rust-lang/rust/issues/28728 https://github.com/rust-lang/rust/issues/28728
LLVM has since added a new intrinsic: https://reviews.llvm.org/D38336 https://reviews.llvm.org/D38336
This will allow us to fix the bug.