[Bug c++/71885] Incorrect code generated with -01, memset() function call is missing
kern at sibbald dot com
gcc-bugzilla@gcc.gnu.org
Fri Jul 15 08:29:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71885
--- Comment #7 from Kern Sibbald <kern at sibbald dot com> ---
Just to be clear:
- This change might be appropriate for higher level of optimization, but is not
appropriate as a default for -O2 and -O1.
- There is no undefined behavior here. We override the new operator explicitly
to be able to allocate and manage the memory the way we want. The g++ compiler
can make assumptions about what a new operator returns, but it should make any
assumptions about what we are doing to initialize memory inside an overridden
new operator particularly at low optimization levels. The g++ behavior is
incorrect in this case. Please correct it.
More information about the Gcc-bugs
mailing list