L.S., This code:
SUBROUTINE S(N) DIMENSION A(N), B(N) READ*,ISTART,ISTOP,B DO I = ISTART, ISTOP A(I) = B(I) ENDDO PRINT*,A END when compiled thusly: $ gfortran -g -S -O3 -ftree-vectorize -ftree-vectorizer-verbose=2 -msse2 vect4.f draws the following "not vectorized" message: vect4.f:4: note: not vectorized: complicated access pattern. vect4.f:4: note: vectorized 0 loops in function. This sort of coding is rather prevalent in HIRLAM, especially in the interesting inner loops. One needs this when not all of the inner area is accessible / computable by the code at hand (for instance because there are inaccessible "halo's" around the subarea that have to be treated specially). The funny thing is that replacing ISTART with a constant makes this loop vectorizable. So what's the fundamental difference (as far as vectorizing is concerned) between a constant and a loop invariant :-) ? Kind regards, -- Toon Moene - e-mail: [EMAIL PROTECTED] - phone: +31 346 214290 Saturnushof 14, 3738 XG Maartensdijk, The Netherlands A maintainer of GNU Fortran 95: http://gcc.gnu.org/fortran/