https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96320
--- Comment #23 from Damian Rouson <damian at sourceryinstitute dot org> --- A related issue arises if the procedure in question is a pure function as demonstrated below. The code compiles cleanly if either 1. The result-spec is absent and the procedure is renamed new_foo in both the interface body and in the procedure definition, or 2. The interface body is repeated in the procedure definition instead the "module procedure" syntax. ± cat pure-shape-mismatch.f90 module foobar implicit none type foo integer bar end type interface pure module function create() result(new_foo) implicit none type(foo) new_foo end function end interface contains module procedure create new_foo%bar = 1 end procedure end module ± gfortran -c pure-shape-mismatch.f90 pure-shape-mismatch.f90:17:4: 17 | new_foo%bar = 1 | 1 Error: Variable ‘new_foo’ cannot appear in a variable definition context (assignment) at (1) in PURE procedure ± gfortran --version GNU Fortran (GCC) 11.0.0 20200804 (experimental)