This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [PATCH, Fortran] PROCEDURE declarations
- From: "Janus Weil" <jaydub66 at googlemail dot com>
- To: "Tobias Burnus" <burnus at net-b dot de>
- Cc: "Tobias Schlüter" <tobias dot schlueter at physik dot uni-muenchen dot de>, "Paul Thomas" <paulthomas2 at wanadoo dot fr>, gcc-patches at gcc dot gnu dot org, fortran at gcc dot gnu dot org, "Steven Bosscher" <stevenb dot gcc at gmail dot com>
- Date: Mon, 3 Sep 2007 13:59:33 +0200
- Subject: Re: [PATCH, Fortran] PROCEDURE declarations
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=googlemail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=jWSigD/Q7r3YH/ibcBVoldVlkazq5Mf6pWoE90tQgzTkFRlmHAbIz1w2+gsCV+zcHNW60SNAkSj+enrxUtjEvvF0x2Ru07EFq4BoocG/cHdTzcFDVHUduchIQFrRcP1WodycnJgioQHjc5QQ+lPa5eRNefi6SXjQbNavrT2mosY=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=HIWsNflWRpVfyqX8F1LNtVdAr/8z5KsZ5jM6bMc1UdrdabeOkZRcvWm6h09qtXRCdoQhKWk5cBgvfdB104PhRb2ShoiAsIrXlEz6Ma6leJ/Jxuf/xw+6rYiYkNA/UFtLUno6t2S/gFn5yzGUZMCxgAluX01Xbh8kv5rfUGkv6iw=
- References: <854832d40708310811m6dce9399qaef770e683058bf6@mail.gmail.com> <46D851FB.4060609@physik.uni-muenchen.de> <46D85CC7.3090802@physik.uni-muenchen.de> <854832d40708311158i85c69ebred5616297cdc1218@mail.gmail.com> <46D9595C.6030308@wanadoo.fr> <854832d40709011516v655ff846p16621d7cfbb252c9@mail.gmail.com> <46D9FE59.8060000@physik.uni-muenchen.de> <854832d40709020433w62a1fdf8h64bacf6ba4ccd1ae@mail.gmail.com> <46DAB364.5040004@physik.uni-muenchen.de> <46DAEF02.2020601@net-b.de>
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