From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22338 invoked by alias); 13 Dec 2010 14:16:09 -0000 Received: (qmail 22291 invoked by uid 22791); 13 Dec 2010 14:16:08 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_FN 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; Mon, 13 Dec 2010 14:16:05 +0000 From: "aldyh at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/45940] [trans-mem] Error of unsafe function even if annotated X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: trans-mem X-Bugzilla-Severity: normal X-Bugzilla-Who: aldyh at gcc dot gnu.org X-Bugzilla-Status: WAITING X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: aldyh 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: Mon, 13 Dec 2010 14:16: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: 2010-12/txt/msg01407.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45940 --- Comment #10 from Aldy Hernandez 2010-12-13 14:15:49 UTC --- [offline rth notes] In function_attribute_inlinable_p, if fndecl is tm_pure and current_function_decl is tm_safe, deny the inlining. This is because tm_pure is the only escape hatch we have for "do not annotate this". E.g. you want to add a call to printf for debugging, or there's some data you know that shouldn't be part of the transaction. The fix for this is to implement __tm_waiver. But you know yourself how tricky getting just the transaction blocks correct has been. Adding holes within the region is... nasty. But probably required eventually. In inline_forbidden_p_stmt, notice asms and prevent them from being inlined if current_function_decl is tm_safe. This will stop early inlining from breaking tm_safe functions when dealing with e.g. system header files that include inline asms.