! { dg-do run }! Testcase for PR libfortran/31001implicit noneinteger::i,j,kinteger,allocatable::mm(:)logical,allocatable::mask(:)do i=2,-2,-1do k=0,1allocate(mm(i),mask(i))mm(:)=kmask(:)=(mm==0)j=count(mask)print*,pack(mm,mask)if(size(pack(mm,mask))/=j)call abortdeallocate(mm,mask)end do end doend