"A function is a specification function if it is a pure function, is not a
standard intrinsic function, is not an internal function, is not a statement
function, and does not have a dummy procedure argument."

This is true for "fn" in:

  function f2 (fn, i)
    integer :: i, fn
    character (len = fn (i)) :: f2

Other compilers give an error as "fn" has no explicit interface (with "PURE").
gfortran simply accepts this statement function. It should at least spit out a
warning.

$ ifort gfortran.dg/char_result_7.f90
fortcom: Error: gfortran.dg/char_result_7.f90, line 36: An explicit interface
is required for a specification function.   [FN]

$ NAG f95  gfortran.dg/char_result_7.f90
Error: gfortran.dg/char_result_7.f90, line 36: Reference to non-specification
function FN in specification expression

$ g95  gfortran.dg/char_result_7.f90 [...]
Error: Specification function 'fn' at (1) must be PURE


-- 
           Summary: Give at least a warning for specification function
                    without explicit interface
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: 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=31817

Reply via email to