public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "patrick.marlier at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/46941] [trans-mem] new/delete operator are unsafe
Date: Fri, 04 Feb 2011 20:13:00 -0000	[thread overview]
Message-ID: <bug-46941-4-CTVKNDt2T0@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-46941-4@http.gcc.gnu.org/bugzilla/>

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


  parent reply	other threads:[~2011-02-04 20:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-14 15:40 [Bug c++/46941] New: " patrick.marlier at gmail dot com
2010-12-22 10:12 ` [Bug c++/46941] " patrick.marlier at gmail dot com
2010-12-22 13:51 ` aldyh at gcc dot gnu.org
2010-12-23 15:45 ` patrick.marlier at gmail dot com
2010-12-23 16:19 ` aldyh at gcc dot gnu.org
2010-12-23 16:28 ` patrick.marlier at gmail dot com
2011-01-12 19:43 ` aldyh at gcc dot gnu.org
2011-02-02 14:17 ` patrick.marlier at gmail dot com
2011-02-03 16:24 ` aldyh at gcc dot gnu.org
2011-02-03 16:41 ` aldyh at gcc dot gnu.org
2011-02-04 13:54 ` patrick.marlier at gmail dot com
2011-02-04 15:31 ` aldyh at gcc dot gnu.org
2011-02-04 18:40 ` aldyh at gcc dot gnu.org
2011-02-04 20:13 ` patrick.marlier at gmail dot com [this message]
2011-02-04 20:16 ` aldyh at gcc dot gnu.org
2011-02-04 20:30 ` patrick.marlier at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-46941-4-CTVKNDt2T0@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).