This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran] RFC: PR fortran/37779, diagnose "missing" recursive
- From: Tobias Burnus <burnus at net-b dot de>
- To: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- Cc: Daniel Kraft <d at domob dot eu>, Fortran List <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 16 Nov 2008 18:40:33 +0100
- Subject: Re: [Patch, Fortran] RFC: PR fortran/37779, diagnose "missing" recursive
- References: <49200D66.8090100@domob.eu> <20081116165624.GA28985@troutmask.apl.washington.edu>
Steve Kargl wrote:
> On Sun, Nov 16, 2008 at 01:09:10PM +0100, Daniel Kraft wrote:
>
>> On the other hand, I guess this could lead to rejects-valid situations
>> and we should think about F77 compatibility where the solution of adding
>> "RECURSIVE" is not available.
>>
> I may not have understood what is written above. It seems you
> want to permit recursion without the RECURSIVE keyword to
> possibly allow Fortran 77 corner cases.
I agree that standard-conforming Fortran 77 cannot have recursive
procedures, but there are legacy programs out there which use recursion.
However, if one uses recursion without RECURSIVE one needs to be utterly
careful as local variables might end up in static memory instead of on
the stack, which of cause leads to wrong results; for such programs one
can use -frecursive. (Actually, if the local variable is an array, it
indeed might end up on the stack; or if one uses -fautomatic.)
I would not completely reject recursive programs, but one could consider
to only allow it with -std=legacy and one should point in the error
message to -std=legacy and -frecursive.
Tobias