From patchwork Tue Jan 8 21:06:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikael Morin X-Patchwork-Id: 210532 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 067472C0086 for ; Wed, 9 Jan 2013 08:06:52 +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=1358284013; h=Comment: DomainKey-Signature:Received: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=zaZ94w6 MQkK7EkQQ9Xea0c1ioqo=; b=VxbTV6tiSFHs8rbbYIzmN6Hc48o59YkQtw6fnZh Oy6jxKUjivWsQ89aOzQ9Jamg8OE9z8q2lTu6bC8QVUhuypqWsp0v+v36CQiy+VSM viJnBxD+gRvH7tP92l05oq7IphM/eTX8/c63fvLYydZjDIhXxUFXN2MbQogdW0I8 5+sE= 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:X-SFR-UUID:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=czVgTHtPFilhGyCfwh/UiMOhT6I1KFcoJBZ5Q6LEfhBL2WqCoC63cAdLsu8v3p Ow9u44pLrfRKpCD5306CUkGlkM4HyQMrI34yzp3XoP+z5mWkelfTNITNmKcGvUBb QZwjznDp1M+QSB0oKhfPPfKAJzNg6voCiqXrl2kAk9HeU=; Received: (qmail 13598 invoked by alias); 8 Jan 2013 21:06:42 -0000 Received: (qmail 13571 invoked by uid 22791); 8 Jan 2013 21:06:41 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp24.services.sfr.fr (HELO smtp24.services.sfr.fr) (93.17.128.82) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 08 Jan 2013 21:06:35 +0000 Received: from filter.sfr.fr (localhost [127.0.0.1]) by msfrf2409.sfr.fr (SMTP Server) with ESMTP id E563F700009E; Tue, 8 Jan 2013 22:06:33 +0100 (CET) Received: from [192.168.1.58] (160.183.72.86.rev.sfr.net [86.72.183.160]) by msfrf2409.sfr.fr (SMTP Server) with ESMTP id 910B5700008F; Tue, 8 Jan 2013 22:06:33 +0100 (CET) X-SFR-UUID: 20130108210633594.910B5700008F@msfrf2409.sfr.fr Message-ID: <50EC8A49.5080802@sfr.fr> Date: Tue, 08 Jan 2013 22:06:17 +0100 From: Mikael Morin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.11) Gecko/20121222 Thunderbird/10.0.11 MIME-Version: 1.0 To: gfortran , gcc-patches Subject: [Patch, fortran] PR47203 Use of module with same name as subroutine X-IsSubscribed: yes 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 Hello, a small, unexciting bug. For the case: subroutine m() use m end subroutine m the USE statement is rejected, but it is not if the subroutine is contained. In the latter case, the namespace of the symbol of the subroutine is the parent namespace, which confuses the error condition in check_for_ambiguous. Regression tested on x86_64-unknown-linux-gnu. OK for trunk? Mikael 2013-01-08 Mikael Morin PR fortran/47203 * module.c (check_for_ambiguous): Get the current program unit using gfc_current_ns. 2013-01-08 Mikael Morin PR fortran/47203 * gfortran.dg/use_28.f90: New test. diff --git a/module.c b/module.c index f3b3caa..604acbb 100644 --- a/module.c +++ b/module.c @@ -4493,7 +4493,7 @@ check_for_ambiguous (gfc_symbol *st_sym, pointer_info *info) module_locus locus; symbol_attribute attr; - if (st_sym->ns->proc_name && st_sym->name == st_sym->ns->proc_name->name) + if (st_sym->name == gfc_current_ns->proc_name->name) { gfc_error ("'%s' of module '%s', imported at %C, is also the name of the " "current program unit", st_sym->name, module_name);