https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83149
--- Comment #7 from Neil Carlson <neil.n.carlson at gmail dot com> --- Perhaps this modification of comment 2 code is clearer. Put this in one file: module mod1 integer :: ncells end module module mod2 contains function get() result(array) use mod1 real array(ncells) array = 1.0 end function end module And this in another (this is different): subroutine sub use mod2 s = sum(get()) end This gives an ICE when compiled with 8.0.0 (20171222). NCELLS is a valid specification expression. A valid full program that calls SUB would have to define NCELLS before doing so. However it is not required that the compiler know the value of NCELLS at compile time.