[Bug c++/46941] [trans-mem] new/delete operator are unsafe
aldyh at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Feb 4 18:40:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46941
--- Comment #12 from Aldy Hernandez <aldyh at gcc dot gnu.org> 2011-02-04 18:40:09 UTC ---
Patrick, the reason memory allocated by the C++ new operator does not get
optimized by the TM-memopt pass is not because of a missing ECF_MALLOC
attribute, but because the alias oracle in GCC considers the chunk of memory as
possibly able to escape from the current function.
That is, the following hunk of code returns true in the TM-memopt pass:
if (ptr_deref_may_alias_global_p (x))
Apparently, since new/delete operators may be overridden by class specific
hooks, the memory must be considered escaped.
So, this is not a TM bug, but a "feature" of the alias oracle in GCC.
More information about the Gcc-bugs
mailing list