From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3383 invoked by alias); 4 Feb 2011 20:13:27 -0000 Received: (qmail 3369 invoked by uid 22791); 4 Feb 2011 20:13:26 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 04 Feb 2011 20:13:21 +0000 From: "patrick.marlier at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/46941] [trans-mem] new/delete operator are unsafe X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: patrick.marlier at gmail dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Fri, 04 Feb 2011 20:13:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-02/txt/msg00681.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46941 --- Comment #13 from Patrick Marlier 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 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.