John Fine wrote: > I have a very large module, which contains a few places where a pointer > is cast based on a templated data type. > > Typically a pointer is created using a templated type, then copied as a > void*, then used as the templated type. In one of those places, the > optimizer removes the copy step, which is correct behavior for the > optimizer under strict aliasing, but of course incorrect for the program. I don't really get this. You are allowed to take a pointer, copy it as a void *, and copy it back to the same type and dereference it. If the compiler removes the copy step, then the compiler is broken. If your code accesses the object via an incompatible type, then your code is broken. Confused, Andrew.