public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "anlauf at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/97063] [ MATMUL intrinsic] The value of result is wrong when vector (step size is negative) * matrix Date: Tue, 22 Sep 2020 19:42:32 +0000 [thread overview] Message-ID: <bug-97063-4-hH0bokfqGY@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-97063-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97063 --- Comment #4 from anlauf at gcc dot gnu.org --- Having looked at the tree-dump, I am not sure if it is a FE or a library issue. I appears that the negative stride miscalculates the base or offset of the array probably by one: program p implicit none integer :: i, j real, dimension(6) :: arr1 = [(i,i=0,5)] real, dimension(6,10) :: arr2 = reshape ([(((i+j),i=0,5),j=0,9)],[6,10]) real, dimension(10) :: arr3, arr6 real, dimension(3) :: arr4 arr4 = arr1(5:1:-2) write(*,*) "--arr6--:" arr6 = matmul (arr4 , arr2(5:1:-2, :)) write(*,'(10F6.1)') arr6 arr4 = arr1(6:2:-2) write(*,*) "--arr6-- (with arr1 off by one):" arr6 = matmul (arr4 , arr2(5:1:-2, :)) write(*,'(10F6.1)') arr6 arr3 = matmul (arr1(5:1:-2), arr2(5:1:-2, :)) write(*,*) "--arr3--:" write(*,'(10F6.1)') arr3 end program This prints: --arr6--: 20.0 26.0 32.0 38.0 44.0 50.0 56.0 62.0 68.0 74.0 --arr6-- (with arr1 off by one): 26.0 35.0 44.0 53.0 62.0 71.0 80.0 89.0 98.0 107.0 --arr3--: 26.0 35.0 44.0 53.0 62.0 71.0 80.0 89.0 98.0 107.0
next prev parent reply other threads:[~2020-09-22 19:42 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-09-16 1:00 [Bug fortran/97063] New: " 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 [this message] 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-hH0bokfqGY@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: linkBe 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).