
AMDG On 11/14/2013 12:29 PM, Niall Douglas wrote:
On 14 Nov 2013 at 7:01, Steven Watanabe wrote:
No, it is not harmless. You cannot safely assume that undefined behavior is ever harmless, just because you can't think of anything that can go wrong. In particular, the compiler is free to make assumptions that can cause your code to miscompile with optimizations on.
For the purposes of my peer review report, can you say if you know of any misoperation which any major compiler might do in this circumstance?
I believe that this was a problem for Boost.Move with gcc, which does something similar. It's actually quite common for old C code that casts between different structs to fail with newer compilers. For instance, Python does not work without -fno-strict-aliasing. In Christ, Steven Watanabe