From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8558 invoked by alias); 1 Feb 2013 14:26:51 -0000 Received: (qmail 7933 invoked by uid 48); 1 Feb 2013 14:26:06 -0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/56174] New: Wrongly accepts "INTEGER :: b = HUGE(b)" Date: Fri, 01 Feb 2013 14:26:00 -0000 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" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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: 2013-02/txt/msg00057.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D56174 Bug #: 56174 Summary: Wrongly accepts "INTEGER :: b =3D HUGE(b)" Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Keywords: accepts-invalid Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned@gcc.gnu.org ReportedBy: burnus@gcc.gnu.org As reported at https://groups.google.com/forum/?fromgroups=3D#!topic/comp.lang.fortran/T9Q= QNONepKM Using INTEGER, PARAMETER :: a(2) =3D (/ 1, 2 /), b =3D HUGE(b) is invalid per the arguments given below. Note, however, that INTEGER, PARAMETER :: a(2) =3D (/ 1, 2 /), b =3D HUGE(a) is valid. gfortran currently accepts it. Fortran 2008 has in "7.1.12 Constant expression" (paragraph below C712): "If a constant expression includes a specification inquiry that depends on a type parameter or an array bound of an entity specified in the same speci=0Ccation-part, the type parameter or array bound shall be specified in a prior specification of the specification-part. The prior specification may be to the left of the specification inquiry in the same statement, but shall not be within the same entity-decl." The latter is: R503 entity-decl is object-name [( array-spec )] [ lbracket coarray-spec rbracket ] [ * char-length ] [ initialization ] or function-name [ * char-length ] Thus, "object-name ... initialization" belongs to the same entry-decl. "HUGE" belongs to the class "Inquiry function" and (cf. 7.1.11 Specification expression): "A specification inquiry is a reference to "(1) an intrinsic inquiry function, [...]"