https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80291
--- Comment #6 from janus at gcc dot gnu.org --- Here is a slightly further reduced version of the test case: module test implicit none type cell_t contains procedure :: get_mask end type contains elemental logical function get_mask (self, inode) implicit none class(cell_t), intent(in) :: self integer, intent(in) :: inode get_mask = .false. end function end module program gfortran_bug use test implicit none class(cell_t), pointer :: cell associate(mask => cell%get_mask([1,2])) end associate end