From patchwork Thu Aug 9 09:12:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 176032 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 C23CB2C00D9 for ; Thu, 9 Aug 2012 19:13:15 +1000 (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=1345108396; h=Comment: DomainKey-Signature:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=yUiPEAh JteK2gTKk9Ni1RP2mx2Q=; b=qsmR62SRglzX9SA/K5A1+0/ABxVR+zVLBEw+xgV jD/4X4HtBrUgt2xRKDVREoSTONBppgI1adcAVNRIvVPQ56x8JlYyyeZ8Eaq5/t+R zVzO44VyJmVD4frLpAU9EklsEkKnOBeOTtCl4Y5u4CBtShPEzm1cvIyJn/F50Yes TxFk= 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:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=qY2N1eWSG2X86neUVf762kM5+LEs7gINYUgOChH2RjhStW0Pbs0Ymdd5PTVx/+ ZjhWA8N/4cegVJkSgNCEGftumO7mVfmCnwe1twlVqfefvGcez4mgKIz27oPPbjbv dOeNwTr9hjQyOzJFiGB+18eh0l5VvZo03UNMxKBz9Pyx4=; Received: (qmail 9852 invoked by alias); 9 Aug 2012 09:13:08 -0000 Received: (qmail 9839 invoked by uid 22791); 9 Aug 2012 09:13:07 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mx02.qsc.de (HELO mx02.qsc.de) (213.148.130.14) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 09 Aug 2012 09:12:54 +0000 Received: from [192.168.178.22] (port-92-204-86-97.dynamic.qsc.de [92.204.86.97]) by mx02.qsc.de (Postfix) with ESMTP id 24B87279D4; Thu, 9 Aug 2012 11:12:49 +0200 (CEST) Message-ID: <50237F0E.1040501@net-b.de> Date: Thu, 09 Aug 2012 11:12:46 +0200 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: gcc patches , gfortran Subject: [Patch, Fortran] PR54199 improve warning "is also the name of an intrinsic" for internal procedures 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 This patch makes the warning for internal procedures whose name is the same as the one of an intrinsic clearer. Initially, I though that one shouldn't warn for internal procedures, but others disagree. In any case, the warning text is better than original one. Build and regstested on x86-64-linux. OK for the trunk? Tobias 2012-08-09 Tobias Burnus PR fortran/54199 * intrinsic.c (gfc_warn_intrinsic_shadow): Better warning for internal procedures. 2012-08-09 Tobias Burnus PR fortran/54199 * gfortran.dg/intrinsic_shadow_4.f90: New. diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index 60c68fe..72b149f 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -4503,7 +4511,7 @@ gfc_warn_intrinsic_shadow (const gfc_symbol* sym, bool in_module, bool func) return; /* Emit the warning. */ - if (in_module) + if (in_module || sym->ns->proc_name) gfc_warning ("'%s' declared at %L may shadow the intrinsic of the same" " name. In order to call the intrinsic, explicit INTRINSIC" " declarations may be required.", --- /dev/null 2012-08-08 07:41:43.631684108 +0200 +++ gcc/gcc/testsuite/gfortran.dg/intrinsic_shadow_4.f90 2012-08-09 10:28:55.000000000 +0200 @@ -0,0 +1,12 @@ +! { dg-do compile } +! { dg-options "-Wall" } +! +! PR fortran/54199 +! +subroutine test() +contains + real function fraction(x) ! { dg-warning "'fraction' declared at .1. may shadow the intrinsic of the same name. In order to call the intrinsic, explicit INTRINSIC declarations may be required." } + real :: x + fraction = x + end function fraction +end subroutine test