https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71885

--- Comment #10 from Kern Sibbald <kern at sibbald dot com> ---
Thanks for your definition of "undetermined" behavior.  The problem here is
that at the time the compiler applied its optimization we were just in the
process of creating the object as is permitted by the C++ language, and in that
process the g++ compiler made what I consider to be a very risky assumption
about the state of the object while it was being created. I maintain that our
code is valid and should not be optimized away by the compiler. This, in my
opinion, is a case of the compiler writer not realizing that his assumption was
not valid in our particular case (object being created in an overridden new). 
The problem would be corrected in general by ensuring that no "unsafe"
optimizations are made at low levels of optimization.  At higher levels the
developer knows he risks problems.

Reply via email to