https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99138
--- Comment #7 from anlauf at gcc dot gnu.org ---
The patch in comment#6 generates an unexpected error:
pr99138.f90:11:2:
11 | module function f(x)
| 1
Error: Type mismatch in function result (CLASS(STAR)/CLASS(*)) between the
MODULE PROCEDURE declaration in MODULE 'm' and the declaration at (1) in
(SUB)MODULE 'm2'
Replacing the module function part with
module procedure f
end
makes the code compile, so I think this is an independent issue... :-(