This is the mail archive of the 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]

[patch, fortran] Dimension of a function result as host association does not work (PR29916)

:ADDPATCH fortran:

As Macro Restelli found out, gfortran does not accept the following
valid code:

integer :: n
  function internal_f()
    real :: internal_f(n) ! Variable 'n' cannot appear in the expression
at (1)
    internal_f = 2
  end function internal_f

The attached patch by Paul fixes this.
I added the test case, regtested on x86_64-unknown-linux-gnu and added
the changelog.

Ok for the trunk and after a week or so for 4.2?


Paul Thomas wrote in PR29916:
> This is nearly identical to PR23446, which I fixed.  It was therefore and easy
> job to extend the principle of host associated variables in dummy specification
> expressions to those of array-valued functions.
> I bolstered up the test for both by insisting that not only the
> gfc_is_formal_arg flag being set but that the symbol should be in the current
> namespace.  If this seems odd, remember that contained procedures' symbols are
> found in their parent's namespace.
> I have checked that host_dummy_index_1.f90 works OK but have not regtested yet.
>   It is possible that ENTRYs are messed up but I have not checked this.
> I am 1000km from my workstation right now and will be there for some 10 days
> yet.  I have not managed to penetrate the firewalls(x4!) here with svn+ssh and
> so can commit nothing.  If you are moved to do so, please take the fix and make
> it fly. Otherwise, I'll do it when I get home.

2006-11-21  Paul Thomas  <>

    PR fortran/29916
    * resolve.c (resolve_symbol): Allow host-associated variables
      in the specification expression of an array-valued function.
    * expr.c (check_restricted): Accept host-associated dummy
      array indices.

2006-11-21  Paul Thomas  <>

    PR fortran/29916
    * gfortran.dg/host_dummy_index_1.f90: Added additional test.

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