3 ms·
Thanks for pointing to this. I'm surprised the specification verbiage differs so much between the two standards. However I think the language for C is aspiratio
by titzer 21d ago
Thanks for pointing to this. I'm surprised the specification verbiage differs so much between the two standards. However I think the language for C is aspirational and there are cases where compiler optimizations will fail this.
- uecker 21d agoThere are a few rare cases where compiler optimization will fail this in GCC. There are also cases where the C spec has defined behavior that optimizers break. Where I know about them, I file bugs. It would be up for users to insist that those get fixed. This includes optimization issues that affect Rust as well.
- Georgelemental 21d agoSome of those cases have been fixed. For example, Clang used to reorder UB around volatile loads, but the latest version no longer does so.
- uecker 21d agoThis is good news! Clang representatives were very basically the only ones against this clarification. Do you have a pointer?
- Georgelemental 21d agohttps://llvm.org/docs/LangRef.html#volatile-memory-accesses https://llvm.org/docs/LangRef.html#volatile-memory-accesses: > Volatile operations are permitted to trap. The compiler may not assume that execution will continue after a volatile operation.