This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/71892] Recent optimization changes introduce bugs
- From: "kern at sibbald dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 27 Aug 2016 14:55:24 +0000
- Subject: [Bug c++/71892] Recent optimization changes introduce bugs
- Auto-submitted: auto-generated
- References: <bug-71892-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71892
--- Comment #11 from Kern Sibbald <kern at sibbald dot com> ---
I recently discussed both of these "optimizations" with Bjarne Stroustrup and
his comment about deleting the memset() when overriding the new() functions
was:
Looks like a bug to me
His comment about deleting the test for a NULL class pointer was:
Yes. According to the standard no object can exists at address 0, so the
optimization seems valid.
So, I repeat: please remove your "bug" that deletes memset() code and causes
program failures.
Despite what he says about removing the NULL pointer, when you do so, you make
it impossible with standard C++ to prevent a seg fault is someone calls a class
function (by error or on purpose) with a NULL pointer. Please rmove this
useless optimization.
Both of your optimizations do not make sense, they give no practical
improvement to the compiler and only serve to introduce failures to programs
that otherwise would run correctly.