From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27438 invoked by alias); 24 Feb 2011 07:14:57 -0000 Received: (qmail 27425 invoked by uid 22791); 24 Feb 2011 07:14:56 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 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; Thu, 24 Feb 2011 07:14:50 +0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/47876] New: Host-assoc generic subroutine plus intrinsic function not rejected X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: accepts-invalid X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Thu, 24 Feb 2011 07:34: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: 2011-02/txt/msg02728.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47876 Summary: Host-assoc generic subroutine plus intrinsic function not rejected Product: gcc Version: 4.6.0 Status: UNCONFIRMED Keywords: accepts-invalid Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned@gcc.gnu.org ReportedBy: burnus@gcc.gnu.org http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/8e0240bbb7628ce2 Steve Lionel claims the code is invalid and NAG also rejects it, which is a good indication that it is indeed invalid - even though at a glance I thought the code is valid. gfortran compiles the following without warning or error: module hostassoc implicit none interface pack module procedure pack_sub end interface contains subroutine pack_sub () end subroutine pack_sub subroutine foo (a) integer, intent(in) :: a(:) ! intrinsic :: pack ! Try uncommenting this line... print *, pack (a, a /= 0) end subroutine foo end module hostassoc Steve wrote: The key to this is paragraph number 5 on p286 of F2008 (12.4.3.4.5 Restrictions on generic declarations). It says: Within the scope of a generic name that is the same as the generic name of an intrinsic procedure, the intrinsic procedure is not accessible by its generic name if the procedures in the interface and the intrinsic procedure are not all functions or not all subroutines. In your case with the INTRINSIC commented out, the PACK intrinsic is made inaccessible because your generic PACK has a subroutine as one of the interfaces. Since the intrinsic is inaccessible, the reference to PACK as a function fails. If you uncomment the INTRINSIC, then you are violating constraint C1215 (F2008) "Within the scope of a generic name, each pair of procedures identified by that name shall both be subroutines or both be functions"