! { dg-do run } ! Test fixes for PR109451 ! Contributed by Harald Anlauf ! call dcs3(['abcd','efgh']) contains subroutine dcs3(a) character(len=*), intent(in) :: a(:) character(:), allocatable :: b(:) b = a(:) call test (b, a, 1) associate (q => b(:)) ! no ICE but print repeated first element call test (q, a, 2) print *, q end associate associate (q => b(:)(:)) ! ICE call test (q, a, 3) associate (r => q(:)(1:3)) call test (r, a(:)(1:3), 4) end associate end associate associate (q => b(:)(2:3)) call test (q, a(:)(2:3), 5) end associate end subroutine dcs3 subroutine test (x, y, i) character(len=*), intent(in) :: x(:), y(:) integer, intent(in) :: i if (any (x .ne. y)) stop i end subroutine test end ! { dg-output " abcdefgh" }