From patchwork Tue Jan 3 21:19:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 134085 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id C0447B6F9C for ; Wed, 4 Jan 2012 08:20:09 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1326230411; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=ujMtssXcJegfV0fagjb7YhwcC7I=; b=I3Dz4Y3DlVJYczA 6S5iul4QuPdRCj1pGAY6Los/HTM4YH3NadSfV5fn6sA5kZFEaa4AC0Y/hc00Ui6w mmVkLtWEHJU5hTPpJRJCy8Jblhsou7Zeji6GDAqoGXgg/GwtY85cZmgeSHw1EeZr G28N2s11XKfewmh2X1iitRKTdsHw= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=mHKbNYhockeF8pfDzB9zq6CpNTb6hfz+AV7v66rwYnAZKiV82eSk9G/x6aIB8g NDAS0xHQoZKtYedoIGlzEz7pKIQx+PyCY3i4bbdgR2RXk5BPc6Ie1pN9Nn+E+Hf8 r8EmnF9xRCCaLgYCUsLTTsvR03NPyzSsVvSht3GDf9aRU=; Received: (qmail 16189 invoked by alias); 3 Jan 2012 21:20:06 -0000 Received: (qmail 16181 invoked by uid 22791); 3 Jan 2012 21:20:04 -0000 X-SWARE-Spam-Status: No, hits=-7.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 03 Jan 2012 21:19:42 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q03LJgaR017917 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 3 Jan 2012 16:19:42 -0500 Received: from houston.quesejoda.com (vpn-9-188.rdu.redhat.com [10.11.9.188]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q03LJfxF027295; Tue, 3 Jan 2012 16:19:41 -0500 Message-ID: <4F0370ED.7010302@redhat.com> Date: Tue, 03 Jan 2012 15:19:41 -0600 From: Aldy Hernandez User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: Richard Henderson CC: gcc-patches Subject: Re: PR middle-end/51696: display indirect function calls properly for trans-mem References: <4F033514.6050904@redhat.com> <4F03387F.308@redhat.com> <4F035EA5.4030502@redhat.com> In-Reply-To: <4F035EA5.4030502@redhat.com> Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On 01/03/12 14:01, Richard Henderson wrote: > On 01/04/2012 04:18 AM, Aldy Hernandez wrote: >> PR middle-end/51696 >> * trans-mem.c (diagnose_tm_1): Display indirect calls with no name >> correctly. > > Ok. > > > r~ Sorry for the noise, but I forgot to check that we actually have a DECL. Patch updated and tested on x86-64 Linux. Still OK? PR middle-end/51696 * trans-mem.c (diagnose_tm_1): Display indirect calls with no name correctly. Index: testsuite/gcc.dg/tm/pr51696.c =================================================================== --- testsuite/gcc.dg/tm/pr51696.c (revision 0) +++ testsuite/gcc.dg/tm/pr51696.c (revision 0) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-fgnu-tm" } */ + +struct list { + void (*compare)(); +} *listPtr; + +static void (*compare)(); + +__attribute__((transaction_safe)) +static void func () { + listPtr->compare(); /* { dg-error "unsafe indirect function call" } */ + compare(); /* { dg-error "unsafe function call" } */ +} Index: trans-mem.c =================================================================== --- trans-mem.c (revision 182848) +++ trans-mem.c (working copy) @@ -664,9 +664,16 @@ diagnose_tm_1 (gimple_stmt_iterator *gsi "unsafe function call %qD within " "atomic transaction", fn); else - error_at (gimple_location (stmt), - "unsafe function call %qE within " - "atomic transaction", fn); + { + if (!DECL_P (fn) || DECL_NAME (fn)) + error_at (gimple_location (stmt), + "unsafe function call %qE within " + "atomic transaction", fn); + else + error_at (gimple_location (stmt), + "unsafe indirect function call within " + "atomic transaction"); + } } else { @@ -675,9 +682,16 @@ diagnose_tm_1 (gimple_stmt_iterator *gsi "unsafe function call %qD within " "% function", fn); else - error_at (gimple_location (stmt), - "unsafe function call %qE within " - "% function", fn); + { + if (!DECL_P (fn) || DECL_NAME (fn)) + error_at (gimple_location (stmt), + "unsafe function call %qE within " + "% function", fn); + else + error_at (gimple_location (stmt), + "unsafe indirect function call within " + "% function"); + } } } }