diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2005-04-30 18:17:54 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2005-04-30 18:17:54 +0000 |
commit | f6c7d65b66de4abc0318718904e5947f663b9d91 (patch) | |
tree | 8d5060179c1555bf00d893dbf55493ade73249a1 /gcc | |
parent | 078885f2b7e25c0e061c2f47d08de46fc58967e9 (diff) | |
download | gcc-f6c7d65b66de4abc0318718904e5947f663b9d91.zip gcc-f6c7d65b66de4abc0318718904e5947f663b9d91.tar.gz gcc-f6c7d65b66de4abc0318718904e5947f663b9d91.tar.bz2 |
Fix matmul PR18857 and supply testcase
From-SVN: r99041
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/matmul_1.f90 | 53 |
2 files changed, 58 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7782528..745c92c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-04-30 Paul Thomas <pault@gcc.gnu.org> + + PR libfortran/18857 + * gfortran.dg/matmul_1.f90: New test. + 2005-04-28 Kazu Hirata <kazu@cs.umass.edu> PR tree-optimization/21030 diff --git a/gcc/testsuite/gfortran.dg/matmul_1.f90 b/gcc/testsuite/gfortran.dg/matmul_1.f90 new file mode 100644 index 0000000..b3881c9 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/matmul_1.f90 @@ -0,0 +1,53 @@ +!{ dg-do run } +! Test MATMUL for various arguments and results +! (test values checked with GNU octave). +! PR18857 was due to an incorrect assertion that component base==0 +! for both input arguments and the result. +! provided by Paul Thomas - pault@gcc.gnu.org + +Program matmul_1 + integer, parameter :: N = 5 + integer, parameter :: T = 4 + integer :: i + real(kind=T), dimension(:,:), allocatable :: a, b, c + real(kind=T), dimension(N,N) :: x, y, z + + allocate (a(2*N, N), b(N, N), c(2*N, N)) + + do i = 1, 2*N + a(i, :) = real (i) + end do + b = 4.0_T + + do i = 1, N + x(i, :) = real (i) + end do + y = 2.0_T + +! whole array + + z = 0.0_T + z = matmul (x, y) + if (sum (z) /= 750.0_T) call abort () + +! array sections + + c = 0.0_T + c = matmul (a(7:9,3:N), b(3:N,3:4)) + if (sum (c) /= 576.0_T) call abort () + +! uses a temp + + c = 0.0_T + c = matmul (a, b + x) + if (sum (c) /= 9625.0_T) call abort () + +! returns to a temp + + c = 0.0_T + c = a + matmul (a, b) + if (sum (c) /= 5775.0_T) call abort () + + deallocate (a, b, c) + +end program matmul_1 |