public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/56174] New: Wrongly accepts "INTEGER :: b = HUGE(b)"
@ 2013-02-01 14:26 burnus at gcc dot gnu.org
  2013-02-01 22:59 ` [Bug fortran/56174] " mikael at gcc dot gnu.org
  2014-01-07 10:39 ` dominiq at lps dot ens.fr
  0 siblings, 2 replies; 3+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-02-01 14:26 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56174

             Bug #: 56174
           Summary: Wrongly accepts "INTEGER :: b = 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=#!topic/comp.lang.fortran/T9QQNONepKM


Using
  INTEGER, PARAMETER :: a(2) = (/ 1, 2 /), b = HUGE(b)
is invalid per the arguments given below.

Note, however, that
  INTEGER, PARAMETER :: a(2) = (/ 1, 2 /), b = 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\fcation-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, [...]"


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug fortran/56174] Wrongly accepts "INTEGER :: b = HUGE(b)"
  2013-02-01 14:26 [Bug fortran/56174] New: Wrongly accepts "INTEGER :: b = HUGE(b)" burnus at gcc dot gnu.org
@ 2013-02-01 22:59 ` mikael at gcc dot gnu.org
  2014-01-07 10:39 ` dominiq at lps dot ens.fr
  1 sibling, 0 replies; 3+ messages in thread
From: mikael at gcc dot gnu.org @ 2013-02-01 22:59 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56174

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikael at gcc dot gnu.org

--- Comment #1 from Mikael Morin <mikael at gcc dot gnu.org> 2013-02-01 22:58:49 UTC ---
(In reply to comment #0)
> Using
>   INTEGER, PARAMETER :: a(2) = (/ 1, 2 /), b = HUGE(b)
> is invalid per the arguments given below.

[...]
> 
> "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\fcation-part, the type parameter or array bound shall be
> specified in a prior specification of the specification-part. 
> 
One could argue that the kind parameter is specified at the end of INTEGER,
thus outside the entity-decl. ;-)
We should allow this;  there is no ambiguity.


I think there were other bugs dealing with self-recursive specification.  I
could only find pr47915, which is loosely related.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug fortran/56174] Wrongly accepts "INTEGER :: b = HUGE(b)"
  2013-02-01 14:26 [Bug fortran/56174] New: Wrongly accepts "INTEGER :: b = HUGE(b)" burnus at gcc dot gnu.org
  2013-02-01 22:59 ` [Bug fortran/56174] " mikael at gcc dot gnu.org
@ 2014-01-07 10:39 ` dominiq at lps dot ens.fr
  1 sibling, 0 replies; 3+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-01-07 10:39 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56174

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-01-07
     Ever confirmed|0                           |1

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Still present at r206385.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-01-07 10:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-01 14:26 [Bug fortran/56174] New: Wrongly accepts "INTEGER :: b = HUGE(b)" burnus at gcc dot gnu.org
2013-02-01 22:59 ` [Bug fortran/56174] " mikael at gcc dot gnu.org
2014-01-07 10:39 ` dominiq at lps dot ens.fr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).