https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122080
--- Comment #5 from Henri Menke <henri at henrimenke dot de> ---
Apologies for supplying non-conforming code.
When I add an explicit interface for the inner routine
subroutine outer(optarr)
real, optional, intent(in) :: optarr(:,:)
interface
subroutine inner(optarr)
real, optional, intent(in) :: optarr(:,:)
end subroutine inner
end interface
call inner(optarr)
end subroutine outer
I obtain identical trees to
subroutine outer(optarr)
real, optional, intent(in) :: optarr(:,:)
call inner(optarr)
end subroutine outer
with GNU Fortran (GCC) 15.1.0.