This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

Re: [PATCH, Fortran] PROCEDURE declarations


Hey guys,
regarding the ENTRY issues:

> > The point is, we've repeatedly had issues with entries creeping out
> > the woodworks.  Entries are weird, and they tend to break assumptions
> > one tacitly makes.  It's worth checking.
>
> Good point. The following crashes with my version of the patch (I don't
> use the latest one):
> test.f90:1: internal compiler error: in build_function_decl, at
> fortran/trans-decl.c:1208
>
>
> SUBROUTINE a
>  abstract interface
>    subroutine abc(x)
>      real x
>    end subroutine
>  end interface
>  procedure(abc) :: abc2
> entry abc2(x)
>  real x
>  x = 0
> end subroutine
> end

This program also crashes with my latest patch. My first thought would
be that the solution is as easy as adding a line

conf (procedure, entry)

in symbol.c (check_conflict). At least this does the job for the above
code, giving an error message a la "PROCEDURE attribute conflicts with
ENTRY attribute", thereby preventing the ICE.

But still I'm not completely sure if this solves all possible problems
with "ENTRY" and if it would reject any legal code. At least sth like
the following works fine:

function f(x) result(r)
implicit none
real r,x
r=2.*x
return
entry g(x) result(r)
r=3.*x
return
end function

program prog
procedure(real):: f,g
!real,external:: f,g
print *,f(5.)
print *,g(5.)
end program

It works with EXTERNAL as well as PROCEDURE, and my
"conf(procedure,entry)"-check does no harm since the main program just
doesn't know it the external symbols f and g are implemented as a
FUNCTION or an ENTRY.
I will post a new patch with this fix, a test case for it and a
"gfc_add_proc" function soon, provided you don't find any further
issues with ENTRY. And maybe we need some more conflict checks with
other attributes? Up to now I really only checked for those with are
accepted by "match_attr_spec". Any ideas?
Cheers,
Janus


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