From patchwork Tue Jul 17 08:13:55 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 171354 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 266912C01BB for ; Tue, 17 Jul 2012 18:14:55 +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=1343117696; 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=Wakmwco sXHVcDbnIqszzssPfJfU=; b=SjtPbvbZgvAeAZj5u/dLtjbsMzRGy+9bd3JqKEJ 2kiUs3CYGGyyQA7Qr/3tqzJymmrjmoGSuWPj4iguueeUmUQQsBfPGlYJsb3gyCp3 NMyE/a5HDtN8OdZVNDJrxCLnDB15VkE8oWKH/YX4g5eWokW/aniEANKtTBxMeDI7 yZrA= 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=veYFn+20xIKdoEW6iWeNe13XuVKYDKW6c8JS4SFbGIRvNQde02YHnOXSMXmqlY cNKALIFGIQTiEYzZ4b9j4WA0rBcsSnywsid7xVWUIbcekboXKHU/UYZwqjh/5fal iGB3eKFazMdyEe/7rQWB4ugtYRZMjDNnD5hfpgpBXuevc=; Received: (qmail 26221 invoked by alias); 17 Jul 2012 08:14:41 -0000 Received: (qmail 26204 invoked by uid 22791); 17 Jul 2012 08:14:39 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_HOSTKARMA_NO 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; Tue, 17 Jul 2012 08:14:26 +0000 Received: from [192.168.178.22] (port-92-204-53-225.dynamic.qsc.de [92.204.53.225]) by mx02.qsc.de (Postfix) with ESMTP id 2393527AB1; Tue, 17 Jul 2012 10:13:59 +0200 (CEST) Message-ID: <50051EC3.3000702@net-b.de> Date: Tue, 17 Jul 2012 10:13:55 +0200 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 To: gcc patches , gfortran Subject: [Patch, Fortran] PR 49265 - allow :: for "procedure :: list" 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 Fortran 2008 now also allows the "::" in module interfaces: "[module] procedure [::] procedure-name-list" The bug is also a sign for bad quality assurance as we previously only fixed the issue for "module procedure" and not also for "procedure". Build and regtested on x86-64-linux. OK for the trunk? Tobias 2012-07-17 Tobias Burnus Steven G. Kargl PR fortran/49265 * decl.c (match_procedure_in_interface): Support "::" for Fortran 2008 and later. 2012-07-17 Tobias Burnus PR fortran/49265 * gfortran.dg/module_procedure_double_colon_3.f90: New. * gfortran.dg/module_procedure_double_colon_4.f90: New. diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index c3644b6..c6ba43e 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -5108,6 +5113,7 @@ match_procedure_in_interface (void) match m; gfc_symbol *sym; char name[GFC_MAX_SYMBOL_LEN + 1]; + locus old_locus; if (current_interface.type == INTERFACE_NAMELESS || current_interface.type == INTERFACE_ABSTRACT) @@ -5116,6 +5122,19 @@ match_procedure_in_interface (void) return MATCH_ERROR; } + /* Check if the F2008 optional double colon appears. */ + gfc_gobble_whitespace (); + old_locus = gfc_current_locus; + if (gfc_match ("::") == MATCH_YES) + { + if (gfc_notify_std (GFC_STD_F2008, "Fortran 2008: double colon in " + "MODULE PROCEDURE statement at %L", &old_locus) + == FAILURE) + return MATCH_ERROR; + } + else + gfc_current_locus = old_locus; + for(;;) { m = gfc_match_name (name); --- /dev/null 2012-07-17 07:28:04.995717470 +0200 +++ gcc/gcc/testsuite/gfortran.dg/module_procedure_double_colon_3.f90 2012-07-17 09:02:29.000000000 +0200 @@ -0,0 +1,16 @@ +! { dg-do compile } +! { dg-options "-std=f2003" } +! +! PR fortran/49265 +! +! Contributed by Erik Toussaint +! +module m1 + implicit none + interface foo + procedure :: bar ! { dg-error "Fortran 2008: double colon in MODULE PROCEDURE statement" } + end interface +contains + subroutine bar + end subroutine +end module --- /dev/null 2012-07-17 07:28:04.995717470 +0200 +++ gcc/gcc/testsuite/gfortran.dg/module_procedure_double_colon_4.f90 2012-07-17 09:07:04.000000000 +0200 @@ -0,0 +1,16 @@ +! { dg-do compile } +! { dg-options "-std=f2008" } +! +! PR fortran/49265 +! +! Contributed by Erik Toussaint +! +module m1 + implicit none + interface foo + procedure :: bar ! "::" is valid since Fortran 2008 + end interface +contains + subroutine bar + end subroutine +end module