Mecej4: I think that your first answer was right in the context of the question asked, and that is that a subprogram with optional arguments needs to have an explicit interface. Without the explicit interface the compiler should be building straightforward traditional subprogram code in which all the arguments are not optional, because it has no way of knowing from the perspective of the caller that the arguments are optional.
It is all too easy for a programmer to assume that the compiler takes into account absolutely every statement in the source code as it works through the file, and can determine the programmer’s intention from even the flimsiest of hints, but there is clearly a limitation to how far ahead in the source code it can look.
You didn’t put it in your own demonstrator, but it seems to me that if one does write a subprogram with optional arguments the first important step that one should take is to check that they are in fact present before using them. Probably the model for this lies in the treatment of the Clearwin+ function WINIO@ where the presence of other arguments is dependent on what is put into the first string argument. The traditionalist like myself has his mind boggled that this works at all, let alone as reliably as it does!
In fact, in your demonstration code it looks to me as if the declaration of F1 as being EXTERNAL is unnecessary* in subroutine S1, as F1 is simply used and not passed as an argument to another routine. It seemed to me at first that program P needed F2 declared as EXTERNAL, although because module M1 contains integer function F2 it is treated differently (as an internal function, not an external one, i.e. as one would treat a traditional statement function).
Eddie
*Not just unnecessarily, but probably incorrectly. I know that EXTERNAL is a rather benign thing to have in a declaration, and in the past I have been advised to put named BLOCK DATA routines in EXTERNAL statements so that the linker looks for them, but never having used named BLOCK DATA then the advice fell on deaf ears.