https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83149
--- Comment #8 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Tue, Dec 26, 2017 at 09:42:54PM +0000, neil.n.carlson at gmail dot com wrote: > > Perhaps this modification of comment 2 code is clearer. ncell is never set. > Put this in one file: > > module mod1 > integer :: ncells > end module > > module mod2 > contains > function get() result(array) > use mod1 > real array(ncells) The reference to ncells is to an undefined entity. > array = 1.0 > end function > end module > > And this in another (this is different): > > subroutine sub > use mod2 You need to have ncells = 1 ! or some other value here. > s = sum(get()) > end > > This gives an ICE when compiled with 8.0.0 (20171222). The code with ncells properly defined defined still hits an ICE. This probably a result of not walking mod2's namespace, but I haven't tried to debug the problem beyond this.