This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/41604] New: Reject result with assumed-length character in INTERFACE decl


Related to PR 41603 but easier to diagnose:

   interface
      function assumed_len(x)
         character(*) assumed_len
         integer, intent(in) :: x
      end function assumed_len
   end interface
   end

ifort claims:

test.f90(2): error #6286: A CHARACTER function name must not be declared with
an asterisk type-param-value (i.e., (LEN=*)) if the function is part of an
interface-body.   [ASSUMED_LEN]
      function assumed_len(x)
---------------^


While other compilers do not complain, I think Intel is right:

"A char-length type parameter value of * has the following meaning: [...]
(4) If used to specify the character length parameter of a function result, any
scoping unit invoking the function shall declare the function name with a
character length parameter value other than * or access such a definition by
host or use association. When the function is invoked, the length of the result
variable in the function is assumed from the value of this type parameter."
(F2003, 4.4.4.1 Character type specifier)

See also thread at
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/bb75425678569ae3

There Richard Maine wrote:

"If a call was legal before, it is still legal with an explicit interface
(almost always*). [...]
The exceptions are arcane, mostly involving some obscure things that
are basically incompatible with having an explicit interface. The only
one I can think of at the moment is assumed-length character function
results"


-- 
           Summary: Reject result with assumed-length character in INTERFACE
                    decl
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: 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=41604


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]