https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118640
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Reduced testcase: module foo type t1 contains procedure bar generic :: assignment(=) => bar end type type t2 type(t1) m end type contains subroutine bar (x, y) intent(in) y class(t1), intent(out) :: x end subroutine end module subroutine baz (x, y) use foo integer y type(t2), pointer, optional :: x interface function qux (x) use foo integer x type(t2) qux end function end interface if (present (x)) then x = qux (y) end if end subroutine