[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 07:11:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71885
Kern Sibbald <kern at sibbald dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kern at sibbald dot com
--- Comment #5 from Kern Sibbald <kern at sibbald dot com> ---
I would like to see a precise explanation of what "undefined behavior" is.
Bacula does zero memory that is passed as a replacement to a new. This
behavior is desirable and very well defined. I may be wrong, but it seems that
you are assuming that the memory is already zero, which is not a good
assumption. In the case of Bacula memory that is allocated from the heap is
non-zero by explicit programming. Consequently this seems to me to be an
overly aggressive optimization that should be enabled at a much higher
optimization level than -O2, generally used by Bacula and many other programs.
At some point g++'s tinkering with valid user's programs should stop. Yes, we
can probably work around the g++ generated bug by explicitly testing for the
g++ compiler version and adding another command line option, but this should be
unnecessary.
Changing g++ in this manner (rather cavalier in my opinion) can create lots of
unnecessary problems for many programs. As you might image, I call this new g++
feature "unreasonable" and "dangerous". Please remove it or at least make it a
new option that the g++ user must explicitly add.
More information about the Gcc-bugs
mailing list