------- Comment #1 from burnus at gcc dot gnu dot org 2007-11-21 18:21 ------- Some quotes from comp.lang.fortran to help with the implementation - or at least rise awareness of some problems.
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/eaa52a125f022287/ ------------- Steve Lionel writes: ----------------------------- The implementation is indeed not trivial and has to be different on each of the three operating systems we support, but it can be done. Note that the standard does say: NOTE 12.16 This standard does not allow internal procedures to be used as actual arguments, in part to simplify the problem of ensuring that internal procedures with recursive hosts access entities from the correct instance (12.5.2.3) of the host. If, as an extension, a processor allows internal procedures to be used as actual arguments, the correct instance in this case is the instance in which the procedure is supplied as an actual argument, even if the corresponding dummy argument is eventually invoked from a different instance. ------------- Steve Lionel writes then later: ------------------------ On Oct 25, 4:57 pm, glen herrmannsfeldt <[EMAIL PROTECTED]> wrote: > Does it have to be invoked from some instance of the containing > procedure? Traditionally, procedure names as actual arguments > were represented by the address of the procedure. In this case, > they have to also include a reference to the instance, mostly > the local variables, of the procedure. It has to be invoked while the containing procedure is active. You can't store it away somewhere and use it later. Once the containing procedure exits, the passed procedure "thing" becomes undefined (as of course do the local variables of the containing procedure.) A common implementation in the past was to write onto the stack a mini- routine that loads a register with the context (address of a frame pointer, etc.) and then calls the actual procedure. Now that operating systems (and processors) block execution of code from the stack, due to viruses taking advantage of this, other places are needed to store the code, but the concept is usually similar. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34162