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