http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46941

--- Comment #13 from Patrick Marlier <patrick.marlier at gmail dot com> 
2011-02-04 20:13:04 UTC ---
Hi Aldy,

On Fri, Feb 4, 2011 at 7:40 PM, aldyh at gcc dot gnu.org <
gcc-bugzi...@gcc.gnu.org> wrote:

> 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.
>
>
I have added the "malloc" attribute to the declaration of the new operator
and it worked so I though this was it. After this I found a discussion about
adding malloc attribute to new operator...


> 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.
>

Hum I see. But if the new/delete operators are not overridden then the
returned memory could be marked as transaction local, right?
Otherwise at least a comment somewhere is welcome to be aware of this
behavior.


> So, this is not a TM bug, but a "feature" of the alias oracle in GCC.


Actually, this was not a bug but an improvement (why using costly write
barriers on transaction local memory).

As usual, thanks ;)

Patrick.

Reply via email to