------- Additional Comments From paulthomas2 at wanadoo dot fr 2005-04-25 20:31 ------- Subject: Re: MATMUL failing with ALLOCATED matrices, unless base indices given
Tobi, Does this do it for you? - it works with those assertions eliminated. !{ dg-do run } ! Test MATMUL for various kinds of array. ! provided by Paul Thomas - [EMAIL PROTECTED] Program test_matmul integer, parameter :: N = 5 integer, parameter :: T = 4 real(kind=T), dimension(:,:), allocatable, Target :: a, b, c real(kind=T), dimension(:,:), POINTER :: d, e real(kind=T), dimension(N,N) :: x, y, z allocate (a(2*N, N), b(N, N), c(2*N, N)) a = 1.0_T a(1:N,:) = 2.0_T b = 4.0_T x = 1.0_T y = 2.0_T z = 0.0_T z = matmul (x, y) if (sum (z) /= 250.0_T) call abort () c = 0.0_T c = matmul (a, b) if (sum (c) /= 1500.0_T) call abort () c = 0.0_T d => a(1 : N, 1:N) c = matmul (d, b) if (sum (c) /= 1000.0_T) call abort () c = 0.0_T d => a(N+1 : 2*N, 1:N) c = matmul (d, b) if (sum (c) /= 500.0_T) call abort () c = 0.0_T e => c(N+1 : 2*N, 1 : N) e = matmul (d, b) if (sum (c(1 : N, 1 : N)) /= 0.0_T) call abort () if (sum (c(N+1 : 2*N, 1 : N)) /= 500.0_T) call abort () call doitagain (a ,b ,c ,x ,y ,z ) deallocate (a, b, c) contains subroutine doitagain (a ,b ,c ,x ,y ,z ) real(kind=T), dimension(5:, 5:) :: a ,b ,c ,x ,y ,z z = 0.0_T z = matmul (x, y) if (sum (z) /= 250.0_T) call abort () c = 0.0_T c = matmul (a, b) if (sum (c) /= 1500.0_T) call abort () end subroutine doitagain end program test_matmul -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18857