I'm trying to assign an array to an array section with a vector subscript:
program test integer, dimension(3) :: model, mesh integer, dimension(1, 3) :: permutation permutation(1,:) = [1, 2, 2] mesh(:) = model(permutation(1,:)) end program test
Compiling with -check, I get:
test.f90(6): error #5581: Shape mismatch: The extent of dimension 1 of array MESH is 3 and the corresponding extent of array MODEL is 1 mesh = model(permutation(1,:)) ---------^ compilation aborted for test.f90 (code 1)
My suspicion is that in this context, the array section I've selected from permutation is incorrectly rank 2. If, however, I force it to rank 1 with reshape(permutation(1,:), ), no error is raised.
I've tried ifort versions 188.8.131.52 and 184.108.40.206
It has nothing to do with rank. The compiler's new shape checking feature is getting confused, thinking that the extent of model(permutation(1,:)) is 1 instead of 3. Please report this bug using the Intel Online Service Center.
For now you can disable shape checking, a new feature in compiler 19.1.