public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "xin.liu@compiler-dev.com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/97063] New: [ MATMUL intrinsic] The value of result is wrong when vector (step size is negative) * matrix
Date: Wed, 16 Sep 2020 01:00:20 +0000	[thread overview]
Message-ID: <bug-97063-4@http.gcc.gnu.org/bugzilla/> (raw)

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.

             reply	other threads:[~2020-09-16  1:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-16  1:00 xin.liu@compiler-dev.com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-97063-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).