From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6E1E8385DC31; Wed, 16 Sep 2020 01:00:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6E1E8385DC31 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1600218020; bh=51WlmOdgcUM7UAP8dgnxom68r9IylHuEFRCw+W2NmCE=; h=From:To:Subject:Date:From; b=UhVdxz0Q/ep5DJujJHZ68wTkRNTukCbDw/UMU9vtBrwkGMZLk0XJ428AXtSxDkw5Z v07nYuCdukg0Sgfnu56x1+opvol9RFj2FvOT4Tm4Ht57R9d8crrg4L7A/DPLL/sHzY MAAaE2JHnsXtqGQzFEiVpi3B3XiiLk2Xxfiy17Ts= From: "xin.liu@compiler-dev.com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 10.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: xin.liu@compiler-dev.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Sep 2020 01:00:20 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97063 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=3D16), dimension(6) :: arr1 real(kind=3D16), dimension(6, 10) :: arr2 real(kind=3D16), dimension(10) :: arr3, arr6 real(kind=3D16), dimension(3) :: arr4 real(kind=3D16), 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 =3D 1, 6 do j =3D 1,10 arr2(i, j) =3D (i + j) * 1.0_16 end do end do write(*,*) "--arr3--:" arr3 =3D matmul(arr1(5:1:-2),arr2(5:1:-2, :)) write(*,'(5F5.1)') arr3 write(*,*) "--arr4--:" arr4 =3D arr1(5:1:-2) write(*,'(5F5.1)') arr4 write(*,*) "--arr6--:" arr6 =3D 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.=