What appears to be happening is
xx = x(n1st:n1nd)
xx = x(1:7)
Which with realloc left hand side enabled resized (reallocates) xx to size of 7.
Try adding -assume:norealloc_lhs to your compiler options.
xx(n1st:n1nd) = x(n1st:n1nd) ! *** with knowledge that xx(8) has not changed.
Please use Jim's second suggestion rather than norealloc_lhs, which disables a major feature of the Fortran standard.