public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/97063] New: [ MATMUL intrinsic] The value of result is wrong when vector (step size is negative) * matrix
@ 2020-09-16  1:00 xin.liu@compiler-dev.com
  2020-09-18 20:42 ` [Bug fortran/97063] " anlauf at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: xin.liu@compiler-dev.com @ 2020-09-16  1:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97063

            Bug ID: 97063
           Summary: [ MATMUL intrinsic] The value of result is wrong when
                    vector (step size is negative) * matrix
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xin.liu@compiler-dev.com
  Target Milestone: ---

Consider the following Fortran program:
program p
    implicit none
    real(kind=16), dimension(6) :: arr1
    real(kind=16), dimension(6, 10) :: arr2
    real(kind=16), dimension(10) :: arr3, arr6
    real(kind=16), dimension(3) :: arr4
    real(kind=16), dimension(3, 10) :: arr5
    integer :: i, j
    data arr1 /0.0_16, 1.0_16, 2.0_16, 3.0_16, 4.0_16, 5.0_16/
    do i = 1, 6
       do j = 1,10
          arr2(i, j) = (i + j) * 1.0_16
       end do
    end do
    write(*,*) "--arr3--:"
    arr3 = matmul(arr1(5:1:-2),arr2(5:1:-2, :))
    write(*,'(5F5.1)') arr3
    write(*,*) "--arr4--:"
    arr4 = arr1(5:1:-2)
    write(*,'(5F5.1)') arr4
    write(*,*) "--arr6--:"
    arr6 = matmul(arr4, arr2(5:1:-2, :))
    write(*,'(5F5.1)') arr6
end program

Compiled with gfortran 10.1.0, the program prints:

 --arr3--:
 44.0 53.0 62.0 71.0 80.0
 89.0 98.0107.0116.0125.0
 --arr4--:
  4.0  2.0  0.0
 --arr6--:
 32.0 38.0 44.0 50.0 56.0
 62.0 68.0 74.0 80.0 86.0

As you can see,the value of arr3 is differnet with arr6.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-10-24 20:16 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-16  1:00 [Bug fortran/97063] New: [ MATMUL intrinsic] The value of result is wrong when vector (step size is negative) * matrix xin.liu@compiler-dev.com
2020-09-18 20:42 ` [Bug fortran/97063] " anlauf at gcc dot gnu.org
2020-09-18 20:49 ` anlauf at gcc dot gnu.org
2020-09-18 22:19 ` jvdelisle at charter dot net
2020-09-22 19:42 ` anlauf at gcc dot gnu.org
2020-10-11 17:59 ` [Bug libfortran/97063] " anlauf at gcc dot gnu.org
2020-10-11 19:10 ` anlauf at gcc dot gnu.org
2020-10-18 18:16 ` cvs-commit at gcc dot gnu.org
2020-10-19 21:07 ` cvs-commit at gcc dot gnu.org
2020-10-24 20:09 ` cvs-commit at gcc dot gnu.org
2020-10-24 20:14 ` cvs-commit at gcc dot gnu.org
2020-10-24 20:16 ` anlauf at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).