This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [4.5, Patch, Fortran] Run-time check for recursion
- From: Daniel Kraft <d at domob dot eu>
- To: Tobias Burnus <burnus at net-b dot de>
- Cc: gcc-patches at gcc dot gnu dot org, fortran at gcc dot gnu dot org
- Date: Sat, 06 Dec 2008 13:52:56 +0100
- Subject: Re: [4.5, Patch, Fortran] Run-time check for recursion
- References: <20081206121456.GA29857@net-b.de>
Tobias Burnus wrote:
Hi all,
the following adds a run-time check for calling a procedure recursively
without without marking it as RECURSIVE. It relies on Paul's/FX's memory
patch, which add the needed option. (I'm also not documenting it, hoping
that the other patch will also adding the needed documentation.)
Daniel, I hope you have not yet started implementing this, but I needed
yesterday evening something which I could do productively.
Hi Tobias,
no problem, I didn't yet find time to start on this!
Regarding your patch, I don't seem to see where the variable is reset to
false when the function exits? As I understand, the generated code
looks like:
void function ()
{
static bool is_recursive = false;
if (is_recursive)
error ();
is_recursive = true;
...
}
And if you had code like
function ()
function ()
This should fail even though the call is not recursive. Does code like
SUBROUTINE foo ()
END SUBROUTINE foo ()
PROGRAM main ()
CALL foo ()
CALL foo ()
END PROGRAM main
work? Apart from that, the patch looks ok for me.
Thanks!
Daniel
--
Done: Arc-Bar-Cav-Rog-Sam-Val-Wiz
To go: Hea-Kni-Mon-Pri-Ran-Tou