http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47266
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-01-15 11:03:13 UTC --- Submitted patch: See http://gcc.gnu.org/ml/fortran/2011-01/msg00094.html There were additional restrictions with BIND(C) - and as Ian pointed out, there are also issues when using the function as specification expression in arguments of PUBLIC functions, cf. http://gcc.gnu.org/ml/fortran/2011-01/msg00100.html For submodules, one also needs to be careful - as submodules can access PRIVATE modules of the host. However, as submodules cannot be USE associated and in order to use them, a "module function/subroutine" is defined in the module, it is known at compile time whether a submodule exists or not. Thus, the optimization can be done - but one needs additional checks whether the function is used in specification expressions (probably only for function results) and later whether the module itself has submodules or not.
