https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90786
Paul Thomas <pault at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |pault at gcc dot gnu.org --- Comment #4 from Paul Thomas <pault at gcc dot gnu.org> --- Created attachment 46465 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46465&action=edit Patch for the PR The testcase compiles and the version below runs correctly with 6.4.1. Thus it is a 7/8/9/10 regression. The attached fix is so trivial that I will commit as obvious this afternoon, if the ongoing regtest is OK. Paul This runs OK with 6.4.1 and trunk with the patch applied: module f procedure(c), pointer :: c_ type :: s integer :: i = 42 end type s class(s), pointer :: res, tgt contains function c() implicit none class(s), pointer :: c c => tgt return end function c subroutine fs() implicit none c_ => c ! This used to ICE return end subroutine fs end module f use f allocate (tgt, source = s(99)) call fs() res => c_() if (res%i .ne. 99) stop 1 deallocate (tgt) end