From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3676A389246E; Tue, 23 Feb 2021 21:10:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3676A389246E From: "anlauf at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/99218] matmul on temporary array accesses invalid memory (segfault) Date: Tue, 23 Feb 2021 21:10:33 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 10.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: anlauf at gcc dot gnu.org X-Bugzilla-Status: NEW 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: cf_known_to_fail Message-ID: In-Reply-To: References: 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: Tue, 23 Feb 2021 21:10:33 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99218 anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Known to fail| |8.4.1 --- Comment #3 from anlauf at gcc dot gnu.org --- Playing with the reduced testcase: fTmp =3D matmul (transpose (G), lambda(::2)) is clean while fTmp =3D matmul (transpose (G), lambda(::1)) is not. It seems we run into a highly optimized code for rank-2 times rank-2. The following patch fixes the testcase: diff --git a/libgfortran/m4/matmul_internal.m4 b/libgfortran/m4/matmul_internal.m4 index 13fd7696238..0e96207a0fc 100644 --- a/libgfortran/m4/matmul_internal.m4 +++ b/libgfortran/m4/matmul_internal.m4 @@ -192,7 +192,8 @@ sinclude(`matmul_asm_'rtype_code`.m4')dnl } } - if (rxstride =3D=3D 1 && axstride =3D=3D 1 && bxstride =3D=3D 1) + if (rxstride =3D=3D 1 && axstride =3D=3D 1 && bxstride =3D=3D 1 + && GFC_DESCRIPTOR_RANK (b) !=3D 1) { /* This block of code implements a tuned matmul, derived from Superscalar GEMM-based level 3 BLAS, Beta version 0.1=