Hi all.

I'm using Intel(R) Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 18.0.1.163 Build 20171018.

It seems to me that the shapes of MATMUL arguments are not checked for conformability if some of them is an allocatable array.

The consequent result are clearly wrong.

Here is a short example, in which the two arguments are clearly non conformable, being one a 1-by-1 array and the other a 5-by-5 array.

Nevertheless, neither at compile-time (that's understandable) nor at runtime there is a complain when performing MATMUL.

That does not change if the arrays are allocated explicitly.

Note that when compiled using gfortran (I used version 4.9.2) a runtime error is issued.

Did I miss some specific compiling option ?

Is it left to the programmer to ensure arguments conformability ?

Thanks a lot.

GM

t_matmul.f90

integer, parameter :: n = 5 real, allocatable :: y(:, :) real, allocatable :: z(:, :) integer :: i, j y = reshape( [ ((i+j/100.0 , i = 1, n), j=1, n) ], [ n, n ]) z = reshape([1.0], [1, 1]) write(*, *) "z: size ", size(z), " shape ", shape(z) write(*, *) "y: size ", size(y), " shape ", shape(y) write(*, *) DO i = 1, size(y,1) WRITE(*, '(19F10.2)') (y(i, j), j=1, size(y,2)) ENDDO write(*, *) write (*, *) "trying y = matmul(z, y) " write(*, *) y = matmul(z, y) DO i = 1, size(y,1) WRITE(*, '(19F10.2)') (y(i, j), j=1, size(y,2)) ENDDO write(*, *) end

$ ifort -warn All -check All -stdlev=f2008 t_matmul.f90 -o t_matmul $ ./t_matmul z: size 1 shape 1 1 y: size 25 shape 5 5 1.01 1.02 1.03 1.04 1.05 2.01 2.02 2.03 2.04 2.05 3.01 3.02 3.03 3.04 3.05 4.01 4.02 4.03 4.04 4.05 5.01 5.02 5.03 5.04 5.05 trying y = matmul(z, y) 1.01 1.02 1.03 1.04 1.05 $ gfortran t_matmul.f90 && ./a.out Z: size 1 shape 1 1 y: size 25 shape 5 5 1.01 1.02 1.03 1.04 1.05 2.01 2.02 2.03 2.04 2.05 3.01 3.02 3.03 3.04 3.05 4.01 4.02 4.03 4.04 4.05 5.01 5.02 5.03 5.04 5.05 trying y = matmul(z, y) Fortran runtime error: dimension of array B incorrect in MATMUL intrinsic