https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109948
--- Comment #1 from Rimvydas (RJ) <rimvydas.jas at gmail dot com> --- More trivial testcase resulting in similar ICE. $ cat test_associate2.f90 subroutine foo(grib) implicit none type b integer, allocatable :: k_2d(:) end type type(b) :: grib integer :: i associate(k=>grib%k_2d) i = k(1) if (any(k==1)) i = 1 end associate end subroutine foo