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/63363] No diagnostic for passing function as actual argument to KIND


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63363

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-12-21
                 CC|                            |janus at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from janus at gcc dot gnu.org ---
(In reply to Ian Harvey from comment #0)
> The following (from recent c.l.f discussion)

this one:

https://groups.google.com/forum/?fromgroups#!topic/comp.lang.fortran/lbaOSWKSmhQ


> compiles without error with
> trunk r215574, despite the actual argument not meeting the requirements for
> the argument of the KIND intrinsic (the argument must be a data entity).

The exact wording in the F08 standard, section 13.7.89, is:

"Argument. X may be of any intrinsic type. It may be a scalar or an array."

I guess it's important here to stress the distinction between a function result
(which is a data entitiy, i.e. scalar or array) and the function itself (which
isnt't).

In case one wants to know the KIND of the function result, one can use
"KIND(f())" (which seems to work correctly with gfortran), and "KIND(f)" indeed
should give an error. Test case:

  PRINT *, KIND(f)
  print *, KIND(f())
contains
  FUNCTION f()
    INTEGER(SELECTED_INT_KIND(4)) :: f
  END FUNCTION
END


Currently prints:
           0
           2
but should reject the first line.


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