This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[libgfortran] patch PR18857 - 2nd round


Bootstrapped and regtested on Cygwin-NT_5.0/i686/XP - OK to commit?

Please note that I have posted a bit of explanation about the patch on
Bugzilla, under PR18857.

The test case is heavily modified - thanks to Paul Brook for suggestions as
to which cases to test.

Paul T

2005-04-29  Paul Thomas  <pault@gcc.gnu.org>

	PR libfortran/18857
	* generated/matmul_r8.c: Remove incorrect assertions.
	* generated/matmul_c4.c: Regenerate
	* generated/matmul_c8.c: Regenerate
	* generated/matmul_i4.c: Regenerate
	* generated/matmul_i8.c: Regenerate
	* generated/matmul_r4.c: Regenerate
	* generated/matmul_r8.c: Regenerate


2005-04-29  Paul Thomas  <pault@gcc.gnu.org>

	PR libfortran/18857
	* gfortran.dg/pr18857.f90: New test.


Index: gcc/libgfortran/m4/matmul.m4
===================================================================
RCS file: /cvsroot/gcc/gcc/libgfortran/m4/matmul.m4,v
retrieving revision 1.9
diff -p -c -3 -r1.9 matmul.m4
*** gcc/libgfortran/m4/matmul.m4	12 Jan 2005 21:27:31 -0000	1.9
--- gcc/libgfortran/m4/matmul.m4	28 Apr 2005 11:31:54 -0000
*************** sinclude(`matmul_asm_'rtype_code`.m4')dn
*** 169,178 ****
        ycount = b->dim[1].ubound + 1 - b->dim[1].lbound;
      }
  
-   assert (a->base == 0);
-   assert (b->base == 0);
-   assert (retarray->base == 0);
- 
    abase = a->data;
    bbase = b->data;
    dest = retarray->data;
--- 169,174 ----  


----------------------------testsuite/gfortran.dg/pr18857.f90---------------
----------

!{ 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 pr18857
  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 pr18857


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]