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/99218] matmul on temporary array accesses invalid memory (segfault)
Date: Tue, 23 Feb 2021 21:10:33 +0000	[thread overview]
Message-ID: <bug-99218-4-aBeoFboZ00@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99218-4@http.gcc.gnu.org/bugzilla/>

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

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 = matmul (transpose (G), lambda(::2))

is clean while

  fTmp = 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 == 1 && axstride == 1 && bxstride == 1)
+  if (rxstride == 1 && axstride == 1 && bxstride == 1
+      && GFC_DESCRIPTOR_RANK (b) != 1)
     {
       /* This block of code implements a tuned matmul, derived from
          Superscalar GEMM-based level 3 BLAS,  Beta version 0.1

  parent reply	other threads:[~2021-02-23 21:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-23 14:16 [Bug fortran/99218] New: " rpmcnally at gmail dot com
2021-02-23 20:07 ` [Bug fortran/99218] " anlauf at gcc dot gnu.org
2021-02-23 20:27 ` anlauf at gcc dot gnu.org
2021-02-23 21:10 ` anlauf at gcc dot gnu.org [this message]
2021-02-23 21:18 ` [Bug libfortran/99218] [8/9/19/11 Regression] " anlauf at gcc dot gnu.org
2021-02-23 21:47 ` anlauf at gcc dot gnu.org
2021-02-23 21:47 ` [Bug libfortran/99218] [8/9/10/11 " anlauf at gcc dot gnu.org
2021-03-05 19:59 ` cvs-commit at gcc dot gnu.org
2021-03-06 17:23 ` cvs-commit at gcc dot gnu.org
2021-03-07 19:42 ` cvs-commit at gcc dot gnu.org
2021-03-07 20:27 ` cvs-commit at gcc dot gnu.org
2021-03-07 20:28 ` 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-99218-4-aBeoFboZ00@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).