public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/34547]  New: NULL(): Fortran 2003 changes, accepts invalid, ICE on invalid
@ 2007-12-21 10:24 burnus at gcc dot gnu dot org
  2008-01-16 21:36 ` [Bug fortran/34547] " burnus at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-12-21 10:24 UTC (permalink / raw)
  To: gcc-bugs

The following gives an ICE:

  print *, NULL()

The program is invalid as the MOLD of NULL([MOLD]) is required in this context
(see F2003, 13.7.88): "If MOLD is absent, the characteristics of the result are
determined by the entity with which the reference is associated. See Table
13.1. MOLD shall not be absent in any other context."

Table 13.1 contains: rhs of pointer assignment; initialization of an object in
a declaration; default component init; struct constr; actual argument; in a
DATA statement.

Likewise for Fortran 97, see 7.1.4.1 around Table 7.2 - and 13.14.79.

---------------------

 integer, allocatable :: i(:)
 print *, NULL(i)

Prints: Error: 'mold' argument of 'null' intrinsic at (1) must be a POINTER.

While Fortran 97 has: "MOLD shall be a pointer and may be of any type."
Fortran 2003 has: "MOLD shall be a pointer or allocatable. It may be of any
type or may be a procedure pointer".

----

NULL as actual argument:

  external foo
  call foo(NULL())

is invalid without a MOLD as (F2003, similar in F97):
"If any type parameters of the contextual entity are deferred, those type
parameters of the result are deferred. If any type parameters of the contextual
entity are assumed, MOLD shall be present.
If the context of the reference to NULL is an actual argument to a generic
procedure, MOLD shall be present if the type, type parameters, or rank is
required to resolve the generic reference. MOLD shall also be present if the
reference appears as an actual argument corresponding to a dummy argument with
assumed character length."

---

Someone could also check whether we do the right thing for:
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/5a1e0cc2c7eb95cc/


-- 
           Summary: NULL(): Fortran 2003 changes, accepts invalid, ICE on
                    invalid
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code, rejects-valid, accepts-invalid,
                    diagnostic
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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


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

end of thread, other threads:[~2014-01-19 11:31 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-34547-4@http.gcc.gnu.org/bugzilla/>
2011-09-14  6:28 ` [Bug fortran/34547] NULL(): Fortran 2003 changes, accepts invalid, ICE on invalid burnus at gcc dot gnu.org
2011-09-14  6:29 ` burnus at gcc dot gnu.org
2011-09-14  7:21 ` burnus at gcc dot gnu.org
2013-06-25 17:48 ` dominiq at lps dot ens.fr
2013-08-25 16:01 ` [Bug fortran/34547] [4.8/4.9 regression] " mikael at gcc dot gnu.org
2013-09-06 11:26 ` rguenth at gcc dot gnu.org
2013-10-16  9:48 ` jakub at gcc dot gnu.org
2013-12-01 10:53 ` burnus at gcc dot gnu.org
2014-01-19 11:29 ` pault at gcc dot gnu.org
2014-01-19 11:31 ` pault at gcc dot gnu.org
2007-12-21 10:24 [Bug fortran/34547] New: " burnus at gcc dot gnu dot org
2008-01-16 21:36 ` [Bug fortran/34547] " burnus at gcc dot gnu dot org
2009-03-29  8:19 ` fxcoudert at gcc dot gnu dot org
2010-05-31 17:36 ` mikael at gcc dot gnu dot org

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).