From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14765 invoked by alias); 27 Feb 2011 16:34:08 -0000 Received: (qmail 14672 invoked by uid 22791); 27 Feb 2011 16:34:07 -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; Sun, 27 Feb 2011 16:34:02 +0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/47915] New: Type declaration: Recursive specification expression not detected. 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, diagnostic 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: Sun, 27 Feb 2011 17:12: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/msg03013.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47915 Summary: Type declaration: Recursive specification expression not detected. Product: gcc Version: 4.6.0 Status: UNCONFIRMED Keywords: accepts-invalid, diagnostic Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned@gcc.gnu.org ReportedBy: burnus@gcc.gnu.org Based on http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/8c8effead3390ad2 The following is invalid as the LEN= specification expression is circular and -- with the "+1" in LEN not possible. (I think without "+1" it might work as the implicit typing has len=1, which is then used to type "a" which can then used for "b" and which then matches the initial value of 1. It is probably still invalid, but at least not contradictory.) >>From the standard: "A variable in a specification expression shall have its type and type parameters, if any, specified by a previous declaration in the same scoping unit, by the implicit typing rules in effect for the scoping unit, or by host or use association. If a variable in a specification expression is typed by the implicit typing rules, its appearance in any subsequent type declaration statement shall confirm the implied type and type parameters." (F2008, 7.1.11 Specification expression) Test case - only g95 complains: Error: Circular specification in variable 'a' at (1) gfortran accepts it even with -std=f95 subroutine foo(a, b) implicit character (A-Z) character(len=len(b)+1) :: a character(len=len(a)+1) :: b end