public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/99218] New: matmul on temporary array accesses invalid memory (segfault)
@ 2021-02-23 14:16 rpmcnally at gmail dot com
  2021-02-23 20:07 ` [Bug fortran/99218] " anlauf at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: rpmcnally at gmail dot com @ 2021-02-23 14:16 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99218
           Summary: matmul on temporary array accesses invalid memory
                    (segfault)
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rpmcnally at gmail dot com
  Target Milestone: ---

Created attachment 50241
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50241&action=edit
Source file

I traced a segfault in our code back to a matmul() where one of the arguments
is the the result of a transpose() call:

  fTmp(:) = matmul(transpose(G(:,:)), lambda(:))

Modifying the code to store the transpose in an intermediate variable appears
to resolve the segfault.  I've reproduced the behavior in some standalone code.
 While the standalone code doesn't segfault, running it under valgrind shows a
lot of invalid memory access.

I do not see this behavior with my system GCC 4.8.5 or 7.3.0.  I do see the
memory issues with GCC 8.3.0, 9.3.0, and 10.2.0.

The source file is attached.  The output from valgrind is below.

gfortran -Wall -Wextra -O0 -g -o issue issue.f90
==13610== Memcheck, a memory error detector
==13610== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==13610== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==13610== Command: ./issue
==13610== 
 Testing Real with Transpose Inline
==13610== Invalid write of size 4
==13610==    at 0x4F3C754: matmul_r4_avx2 (matmul_r4.c:965)
==13610==    by 0x401873: test_real_transposeinline.3 (issue.f90:36)
==13610==    by 0x401932: main.4 (issue.f90:14)
==13610==    by 0x400D01: MAIN__ (issue.f90:5)
==13610==    by 0x401AC3: main (issue.f90:5)
==13610==  Address 0x5e1f3d0 is 0 bytes after a block of size 2,048 alloc'd
==13610==    at 0x4C29F73: malloc (vg_replace_malloc.c:309)
==13610==    by 0x4F39602: matmul_r4_avx2 (matmul_r4.c:909)
==13610==    by 0x401873: test_real_transposeinline.3 (issue.f90:36)
==13610==    by 0x401932: main.4 (issue.f90:14)
==13610==    by 0x400D01: MAIN__ (issue.f90:5)
==13610==    by 0x401AC3: main (issue.f90:5)
==13610== 
==13610== Invalid write of size 4
==13610==    at 0x4F3C785: matmul_r4_avx2 (matmul_r4.c:965)
==13610==    by 0x401873: test_real_transposeinline.3 (issue.f90:36)
==13610==    by 0x401932: main.4 (issue.f90:14)
==13610==    by 0x400D01: MAIN__ (issue.f90:5)
==13610==    by 0x401AC3: main (issue.f90:5)
==13610==  Address 0x5e1f7d0 is 960 bytes inside an unallocated block of size
4,176,848 in arena "client"
==13610== 
==13610== Invalid write of size 4
==13610==    at 0x4F3C7B5: matmul_r4_avx2 (matmul_r4.c:965)
==13610==    by 0x401873: test_real_transposeinline.3 (issue.f90:36)
==13610==    by 0x401932: main.4 (issue.f90:14)
==13610==    by 0x400D01: MAIN__ (issue.f90:5)
==13610==    by 0x401AC3: main (issue.f90:5)
==13610==  Address 0x5e1fbd0 is 1,984 bytes inside an unallocated block of size
4,176,848 in arena "client"
==13610== 
==13610== Invalid write of size 4
==13610==    at 0x4F3C7E6: matmul_r4_avx2 (matmul_r4.c:965)
==13610==    by 0x401873: test_real_transposeinline.3 (issue.f90:36)
==13610==    by 0x401932: main.4 (issue.f90:14)
==13610==    by 0x400D01: MAIN__ (issue.f90:5)
==13610==    by 0x401AC3: main (issue.f90:5)
==13610==  Address 0x5e1ffd0 is 3,008 bytes inside an unallocated block of size
4,176,848 in arena "client"
==13610== 
==13610== Invalid read of size 4
==13610==    at 0x4F3CE50: matmul_r4_avx2 (matmul_r4.c:1093)
==13610==    by 0x401873: test_real_transposeinline.3 (issue.f90:36)
==13610==    by 0x401932: main.4 (issue.f90:14)
==13610==    by 0x400D01: MAIN__ (issue.f90:5)
==13610==    by 0x401AC3: main (issue.f90:5)
==13610==  Address 0x5e1f3d0 is 0 bytes after a block of size 2,048 alloc'd
==13610==    at 0x4C29F73: malloc (vg_replace_malloc.c:309)
==13610==    by 0x4F39602: matmul_r4_avx2 (matmul_r4.c:909)
==13610==    by 0x401873: test_real_transposeinline.3 (issue.f90:36)
==13610==    by 0x401932: main.4 (issue.f90:14)
==13610==    by 0x400D01: MAIN__ (issue.f90:5)
==13610==    by 0x401AC3: main (issue.f90:5)
==13610== 
==13610== Invalid read of size 4
==13610==    at 0x4F3CE5E: matmul_r4_avx2 (matmul_r4.c:1095)
==13610==    by 0x401873: test_real_transposeinline.3 (issue.f90:36)
==13610==    by 0x401932: main.4 (issue.f90:14)
==13610==    by 0x400D01: MAIN__ (issue.f90:5)
==13610==    by 0x401AC3: main (issue.f90:5)
==13610==  Address 0x5e1f7d0 is 960 bytes inside an unallocated block of size
4,176,848 in arena "client"
==13610== 
==13610== Invalid read of size 4
==13610==    at 0x4F3D1A4: matmul_r4_avx2 (matmul_r4.c:1110)
==13610==    by 0x401873: test_real_transposeinline.3 (issue.f90:36)
==13610==    by 0x401932: main.4 (issue.f90:14)
==13610==    by 0x400D01: MAIN__ (issue.f90:5)
==13610==    by 0x401AC3: main (issue.f90:5)
==13610==  Address 0x5e1fbd0 is 1,984 bytes inside an unallocated block of size
4,176,848 in arena "client"
==13610== 
 Testing Complex with Transpose Inline
==13610== Invalid write of size 8
==13610==    at 0x4F7A644: matmul_c4_avx2 (matmul_c4.c:965)
==13610==    by 0x4014F4: test_complex_transposeinline.2 (issue.f90:52)
==13610==    by 0x4019A4: main.4 (issue.f90:16)
==13610==    by 0x400D01: MAIN__ (issue.f90:5)
==13610==    by 0x401AC3: main (issue.f90:5)
==13610==  Address 0x5e20540 is 0 bytes after a block of size 4,096 alloc'd
==13610==    at 0x4C29F73: malloc (vg_replace_malloc.c:309)
==13610==    by 0x4F7617C: matmul_c4_avx2 (matmul_c4.c:909)
==13610==    by 0x4014F4: test_complex_transposeinline.2 (issue.f90:52)
==13610==    by 0x4019A4: main.4 (issue.f90:16)
==13610==    by 0x400D01: MAIN__ (issue.f90:5)
==13610==    by 0x401AC3: main (issue.f90:5)
==13610== 
==13610== Invalid write of size 8
==13610==    at 0x4F7A64C: matmul_c4_avx2 (matmul_c4.c:965)
==13610==    by 0x4014F4: test_complex_transposeinline.2 (issue.f90:52)
==13610==    by 0x4019A4: main.4 (issue.f90:16)
==13610==    by 0x400D01: MAIN__ (issue.f90:5)
==13610==    by 0x401AC3: main (issue.f90:5)
==13610==  Address 0x5e20d40 is 1,984 bytes inside an unallocated block of size
4,172,384 in arena "client"
==13610== 
==13610== Invalid write of size 8
==13610==    at 0x4F7A7C3: matmul_c4_avx2 (matmul_c4.c:965)
==13610==    by 0x4014F4: test_complex_transposeinline.2 (issue.f90:52)
==13610==    by 0x4019A4: main.4 (issue.f90:16)
==13610==    by 0x400D01: MAIN__ (issue.f90:5)
==13610==    by 0x401AC3: main (issue.f90:5)
==13610==  Address 0x5e21540 is 4,032 bytes inside an unallocated block of size
4,172,384 in arena "client"
==13610== 
==13610== Invalid write of size 8
==13610==    at 0x4F7A7CC: matmul_c4_avx2 (matmul_c4.c:965)
==13610==    by 0x4014F4: test_complex_transposeinline.2 (issue.f90:52)
==13610==    by 0x4019A4: main.4 (issue.f90:16)
==13610==    by 0x400D01: MAIN__ (issue.f90:5)
==13610==    by 0x401AC3: main (issue.f90:5)
==13610==  Address 0x5e21d40 is 6,080 bytes inside an unallocated block of size
4,172,384 in arena "client"
==13610== 
==13610== Invalid read of size 4
==13610==    at 0x4F7B0C2: matmul_c4_avx2 (matmul_c4.c:1092)
==13610==    by 0x4014F4: test_complex_transposeinline.2 (issue.f90:52)
==13610==    by 0x4019A4: main.4 (issue.f90:16)
==13610==    by 0x400D01: MAIN__ (issue.f90:5)
==13610==    by 0x401AC3: main (issue.f90:5)
==13610==  Address 0x5e20d44 is 1,988 bytes inside an unallocated block of size
4,172,384 in arena "client"
==13610== 
==13610== Invalid read of size 4
==13610==    at 0x4F7B0E4: matmul_c4_avx2 (matmul_c4.c:1089)
==13610==    by 0x4014F4: test_complex_transposeinline.2 (issue.f90:52)
==13610==    by 0x4019A4: main.4 (issue.f90:16)
==13610==    by 0x400D01: MAIN__ (issue.f90:5)
==13610==    by 0x401AC3: main (issue.f90:5)
==13610==  Address 0x5e20540 is 0 bytes after a block of size 4,096 alloc'd
==13610==    at 0x4C29F73: malloc (vg_replace_malloc.c:309)
==13610==    by 0x4F7617C: matmul_c4_avx2 (matmul_c4.c:909)
==13610==    by 0x4014F4: test_complex_transposeinline.2 (issue.f90:52)
==13610==    by 0x4019A4: main.4 (issue.f90:16)
==13610==    by 0x400D01: MAIN__ (issue.f90:5)
==13610==    by 0x401AC3: main (issue.f90:5)
==13610== 
==13610== Invalid read of size 4
==13610==    at 0x4F7B0EC: matmul_c4_avx2 (matmul_c4.c:1087)
==13610==    by 0x4014F4: test_complex_transposeinline.2 (issue.f90:52)
==13610==    by 0x4019A4: main.4 (issue.f90:16)
==13610==    by 0x400D01: MAIN__ (issue.f90:5)
==13610==    by 0x401AC3: main (issue.f90:5)
==13610==  Address 0x5e20d40 is 1,984 bytes inside an unallocated block of size
4,172,384 in arena "client"
==13610== 
==13610== Invalid read of size 4
==13610==    at 0x4F7B0F1: matmul_c4_avx2 (matmul_c4.c:1087)
==13610==    by 0x4014F4: test_complex_transposeinline.2 (issue.f90:52)
==13610==    by 0x4019A4: main.4 (issue.f90:16)
==13610==    by 0x400D01: MAIN__ (issue.f90:5)
==13610==    by 0x401AC3: main (issue.f90:5)
==13610==  Address 0x5e20544 is 4 bytes after a block of size 4,096 alloc'd
==13610==    at 0x4C29F73: malloc (vg_replace_malloc.c:309)
==13610==    by 0x4F7617C: matmul_c4_avx2 (matmul_c4.c:909)
==13610==    by 0x4014F4: test_complex_transposeinline.2 (issue.f90:52)
==13610==    by 0x4019A4: main.4 (issue.f90:16)
==13610==    by 0x400D01: MAIN__ (issue.f90:5)
==13610==    by 0x401AC3: main (issue.f90:5)
==13610== 
==13610== Invalid read of size 4
==13610==    at 0x4F7B833: matmul_c4_avx2 (matmul_c4.c:1110)
==13610==    by 0x4014F4: test_complex_transposeinline.2 (issue.f90:52)
==13610==    by 0x4019A4: main.4 (issue.f90:16)
==13610==    by 0x400D01: MAIN__ (issue.f90:5)
==13610==    by 0x401AC3: main (issue.f90:5)
==13610==  Address 0x5e21544 is 4,036 bytes inside an unallocated block of size
4,172,384 in arena "client"
==13610== 
==13610== Invalid read of size 4
==13610==    at 0x4F7B838: matmul_c4_avx2 (matmul_c4.c:1110)
==13610==    by 0x4014F4: test_complex_transposeinline.2 (issue.f90:52)
==13610==    by 0x4019A4: main.4 (issue.f90:16)
==13610==    by 0x400D01: MAIN__ (issue.f90:5)
==13610==    by 0x401AC3: main (issue.f90:5)
==13610==  Address 0x5e21540 is 4,032 bytes inside an unallocated block of size
4,172,384 in arena "client"
==13610== 
 Testing Real with Transpose Variable
 Testing Complex with Transpose Variable
==13610== 
==13610== HEAP SUMMARY:
==13610==     in use at exit: 0 bytes in 0 blocks
==13610==   total heap usage: 39 allocs, 39 frees, 41,616 bytes allocated
==13610== 
==13610== All heap blocks were freed -- no leaks are possible
==13610== 
==13610== For lists of detected and suppressed errors, rerun with: -s
==13610== ERROR SUMMARY: 20 errors from 17 contexts (suppressed: 0 from 0)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/99218] matmul on temporary array accesses invalid memory (segfault)
  2021-02-23 14:16 [Bug fortran/99218] New: matmul on temporary array accesses invalid memory (segfault) rpmcnally at gmail dot com
@ 2021-02-23 20:07 ` anlauf at gcc dot gnu.org
  2021-02-23 20:27 ` anlauf at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-02-23 20:07 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
                 CC|                            |anlauf at gcc dot gnu.org
   Last reconfirmed|                            |2021-02-23
             Status|UNCONFIRMED                 |NEW
      Known to fail|                            |10.2.1, 11.0, 9.3.1

--- Comment #1 from anlauf at gcc dot gnu.org ---
Confirmed for matmul(transpose(A),v), where v is of rank 1.

No issue for: matmul(A,v) or matmul(transpose(A),B), where B is of rank 2.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/99218] matmul on temporary array accesses invalid memory (segfault)
  2021-02-23 14:16 [Bug fortran/99218] New: matmul on temporary array accesses invalid memory (segfault) 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
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-02-23 20:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from anlauf at gcc dot gnu.org ---
Reduced testcase:

program play
  implicit none
  integer, parameter :: NCON = 1
  integer, parameter :: NSTATE = 3
  real,    parameter :: ZERO = 0.0
  real :: G(nCon,nState) = ZERO
  real :: lambda(nCon)   = ZERO
  real :: fTmp(nState)   = ZERO
  fTmp = matmul (transpose (G), lambda)
end program

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/99218] matmul on temporary array accesses invalid memory (segfault)
  2021-02-23 14:16 [Bug fortran/99218] New: matmul on temporary array accesses invalid memory (segfault) 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
  2021-02-23 21:18 ` [Bug libfortran/99218] [8/9/19/11 Regression] " anlauf at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-02-23 21:10 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libfortran/99218] [8/9/19/11 Regression] matmul on temporary array accesses invalid memory (segfault)
  2021-02-23 14:16 [Bug fortran/99218] New: matmul on temporary array accesses invalid memory (segfault) rpmcnally at gmail dot com
                   ` (2 preceding siblings ...)
  2021-02-23 21:10 ` anlauf at gcc dot gnu.org
@ 2021-02-23 21:18 ` anlauf at gcc dot gnu.org
  2021-02-23 21:47 ` anlauf at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-02-23 21:18 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|matmul on temporary array   |[8/9/19/11 Regression]
                   |accesses invalid memory     |matmul on temporary array
                   |(segfault)                  |accesses invalid memory
                   |                            |(segfault)
           Priority|P3                          |P4
           Keywords|                            |wrong-code
          Component|fortran                     |libfortran

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libfortran/99218] [8/9/19/11 Regression] matmul on temporary array accesses invalid memory (segfault)
  2021-02-23 14:16 [Bug fortran/99218] New: matmul on temporary array accesses invalid memory (segfault) rpmcnally at gmail dot com
                   ` (3 preceding siblings ...)
  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
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-02-23 21:47 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |anlauf at gcc dot gnu.org

--- Comment #4 from anlauf at gcc dot gnu.org ---
Patch: https://gcc.gnu.org/pipermail/fortran/2021-February/055751.html

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libfortran/99218] [8/9/10/11 Regression] matmul on temporary array accesses invalid memory (segfault)
  2021-02-23 14:16 [Bug fortran/99218] New: matmul on temporary array accesses invalid memory (segfault) rpmcnally at gmail dot com
                   ` (4 preceding siblings ...)
  2021-02-23 21:47 ` anlauf at gcc dot gnu.org
@ 2021-02-23 21:47 ` anlauf at gcc dot gnu.org
  2021-03-05 19:59 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-02-23 21:47 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[8/9/19/11 Regression]      |[8/9/10/11 Regression]
                   |matmul on temporary array   |matmul on temporary array
                   |accesses invalid memory     |accesses invalid memory
                   |(segfault)                  |(segfault)
   Target Milestone|---                         |8.5

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libfortran/99218] [8/9/10/11 Regression] matmul on temporary array accesses invalid memory (segfault)
  2021-02-23 14:16 [Bug fortran/99218] New: matmul on temporary array accesses invalid memory (segfault) rpmcnally at gmail dot com
                   ` (5 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-05 19:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:b1bee29167df6b0fbc9a4c8d06e2acbf3367af47

commit r11-7531-gb1bee29167df6b0fbc9a4c8d06e2acbf3367af47
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Fri Mar 5 20:57:54 2021 +0100

    PR libfortran/99218 - matmul on temporary array accesses invalid memory

    Do not invoke tuned rank-2 times rank-2 matmul if rank(b) == 1.

    libgfortran/ChangeLog:

            PR libfortran/99218
            * m4/matmul_internal.m4: Invoke tuned matmul only for rank(b)>1.
            * generated/matmul_c10.c: Regenerated.
            * generated/matmul_c16.c: Likewise.
            * generated/matmul_c4.c: Likewise.
            * generated/matmul_c8.c: Likewise.
            * generated/matmul_i1.c: Likewise.
            * generated/matmul_i16.c: Likewise.
            * generated/matmul_i2.c: Likewise.
            * generated/matmul_i4.c: Likewise.
            * generated/matmul_i8.c: Likewise.
            * generated/matmul_r10.c: Likewise.
            * generated/matmul_r16.c: Likewise.
            * generated/matmul_r4.c: Likewise.
            * generated/matmul_r8.c: Likewise.
            * generated/matmulavx128_c10.c: Likewise.
            * generated/matmulavx128_c16.c: Likewise.
            * generated/matmulavx128_c4.c: Likewise.
            * generated/matmulavx128_c8.c: Likewise.
            * generated/matmulavx128_i1.c: Likewise.
            * generated/matmulavx128_i16.c: Likewise.
            * generated/matmulavx128_i2.c: Likewise.
            * generated/matmulavx128_i4.c: Likewise.
            * generated/matmulavx128_i8.c: Likewise.
            * generated/matmulavx128_r10.c: Likewise.
            * generated/matmulavx128_r16.c: Likewise.
            * generated/matmulavx128_r4.c: Likewise.
            * generated/matmulavx128_r8.c: Likewise.

    gcc/testsuite/ChangeLog:

            PR libfortran/99218
            * gfortran.dg/matmul_21.f90: New test.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libfortran/99218] [8/9/10/11 Regression] matmul on temporary array accesses invalid memory (segfault)
  2021-02-23 14:16 [Bug fortran/99218] New: matmul on temporary array accesses invalid memory (segfault) rpmcnally at gmail dot com
                   ` (6 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-06 17:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:4fbef612ca1adb71c90eab0d6a682ec6af5b7c93

commit r10-9420-g4fbef612ca1adb71c90eab0d6a682ec6af5b7c93
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Fri Mar 5 20:57:54 2021 +0100

    PR libfortran/99218 - matmul on temporary array accesses invalid memory

    Do not invoke tuned rank-2 times rank-2 matmul if rank(b) == 1.

    libgfortran/ChangeLog:

            PR libfortran/99218
            * m4/matmul_internal.m4: Invoke tuned matmul only for rank(b)>1.
            * generated/matmul_c10.c: Regenerated.
            * generated/matmul_c16.c: Likewise.
            * generated/matmul_c4.c: Likewise.
            * generated/matmul_c8.c: Likewise.
            * generated/matmul_i1.c: Likewise.
            * generated/matmul_i16.c: Likewise.
            * generated/matmul_i2.c: Likewise.
            * generated/matmul_i4.c: Likewise.
            * generated/matmul_i8.c: Likewise.
            * generated/matmul_r10.c: Likewise.
            * generated/matmul_r16.c: Likewise.
            * generated/matmul_r4.c: Likewise.
            * generated/matmul_r8.c: Likewise.
            * generated/matmulavx128_c10.c: Likewise.
            * generated/matmulavx128_c16.c: Likewise.
            * generated/matmulavx128_c4.c: Likewise.
            * generated/matmulavx128_c8.c: Likewise.
            * generated/matmulavx128_i1.c: Likewise.
            * generated/matmulavx128_i16.c: Likewise.
            * generated/matmulavx128_i2.c: Likewise.
            * generated/matmulavx128_i4.c: Likewise.
            * generated/matmulavx128_i8.c: Likewise.
            * generated/matmulavx128_r10.c: Likewise.
            * generated/matmulavx128_r16.c: Likewise.
            * generated/matmulavx128_r4.c: Likewise.
            * generated/matmulavx128_r8.c: Likewise.

    gcc/testsuite/ChangeLog:

            PR libfortran/99218
            * gfortran.dg/matmul_21.f90: New test.

    (cherry picked from commit b1bee29167df6b0fbc9a4c8d06e2acbf3367af47)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libfortran/99218] [8/9/10/11 Regression] matmul on temporary array accesses invalid memory (segfault)
  2021-02-23 14:16 [Bug fortran/99218] New: matmul on temporary array accesses invalid memory (segfault) rpmcnally at gmail dot com
                   ` (7 preceding siblings ...)
  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
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-07 19:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:1dfa6e6c50be570b8240793f58cdac95be9dd3ef

commit r9-9273-g1dfa6e6c50be570b8240793f58cdac95be9dd3ef
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Fri Mar 5 20:57:54 2021 +0100

    PR libfortran/99218 - matmul on temporary array accesses invalid memory

    Do not invoke tuned rank-2 times rank-2 matmul if rank(b) == 1.

    libgfortran/ChangeLog:

            PR libfortran/99218
            * m4/matmul_internal.m4: Invoke tuned matmul only for rank(b)>1.
            * generated/matmul_c10.c: Regenerated.
            * generated/matmul_c16.c: Likewise.
            * generated/matmul_c4.c: Likewise.
            * generated/matmul_c8.c: Likewise.
            * generated/matmul_i1.c: Likewise.
            * generated/matmul_i16.c: Likewise.
            * generated/matmul_i2.c: Likewise.
            * generated/matmul_i4.c: Likewise.
            * generated/matmul_i8.c: Likewise.
            * generated/matmul_r10.c: Likewise.
            * generated/matmul_r16.c: Likewise.
            * generated/matmul_r4.c: Likewise.
            * generated/matmul_r8.c: Likewise.
            * generated/matmulavx128_c10.c: Likewise.
            * generated/matmulavx128_c16.c: Likewise.
            * generated/matmulavx128_c4.c: Likewise.
            * generated/matmulavx128_c8.c: Likewise.
            * generated/matmulavx128_i1.c: Likewise.
            * generated/matmulavx128_i16.c: Likewise.
            * generated/matmulavx128_i2.c: Likewise.
            * generated/matmulavx128_i4.c: Likewise.
            * generated/matmulavx128_i8.c: Likewise.
            * generated/matmulavx128_r10.c: Likewise.
            * generated/matmulavx128_r16.c: Likewise.
            * generated/matmulavx128_r4.c: Likewise.
            * generated/matmulavx128_r8.c: Likewise.

    gcc/testsuite/ChangeLog:

            PR libfortran/99218
            * gfortran.dg/matmul_21.f90: New test.

    (cherry picked from commit b1bee29167df6b0fbc9a4c8d06e2acbf3367af47)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libfortran/99218] [8/9/10/11 Regression] matmul on temporary array accesses invalid memory (segfault)
  2021-02-23 14:16 [Bug fortran/99218] New: matmul on temporary array accesses invalid memory (segfault) rpmcnally at gmail dot com
                   ` (8 preceding siblings ...)
  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
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-07 20:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-8 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:547563ba5abd685077d37a67c7d6fc9b54653934

commit r8-10787-g547563ba5abd685077d37a67c7d6fc9b54653934
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Fri Mar 5 20:57:54 2021 +0100

    PR libfortran/99218 - matmul on temporary array accesses invalid memory

    Do not invoke tuned rank-2 times rank-2 matmul if rank(b) == 1.

    libgfortran/ChangeLog:

            PR libfortran/99218
            * m4/matmul_internal.m4: Invoke tuned matmul only for rank(b)>1.
            * generated/matmul_c10.c: Regenerated.
            * generated/matmul_c16.c: Likewise.
            * generated/matmul_c4.c: Likewise.
            * generated/matmul_c8.c: Likewise.
            * generated/matmul_i1.c: Likewise.
            * generated/matmul_i16.c: Likewise.
            * generated/matmul_i2.c: Likewise.
            * generated/matmul_i4.c: Likewise.
            * generated/matmul_i8.c: Likewise.
            * generated/matmul_r10.c: Likewise.
            * generated/matmul_r16.c: Likewise.
            * generated/matmul_r4.c: Likewise.
            * generated/matmul_r8.c: Likewise.
            * generated/matmulavx128_c10.c: Likewise.
            * generated/matmulavx128_c16.c: Likewise.
            * generated/matmulavx128_c4.c: Likewise.
            * generated/matmulavx128_c8.c: Likewise.
            * generated/matmulavx128_i1.c: Likewise.
            * generated/matmulavx128_i16.c: Likewise.
            * generated/matmulavx128_i2.c: Likewise.
            * generated/matmulavx128_i4.c: Likewise.
            * generated/matmulavx128_i8.c: Likewise.
            * generated/matmulavx128_r10.c: Likewise.
            * generated/matmulavx128_r16.c: Likewise.
            * generated/matmulavx128_r4.c: Likewise.
            * generated/matmulavx128_r8.c: Likewise.

    gcc/testsuite/ChangeLog:

            PR libfortran/99218
            * gfortran.dg/matmul_21.f90: New test.

    (cherry picked from commit b1bee29167df6b0fbc9a4c8d06e2acbf3367af47)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libfortran/99218] [8/9/10/11 Regression] matmul on temporary array accesses invalid memory (segfault)
  2021-02-23 14:16 [Bug fortran/99218] New: matmul on temporary array accesses invalid memory (segfault) rpmcnally at gmail dot com
                   ` (9 preceding siblings ...)
  2021-03-07 20:27 ` cvs-commit at gcc dot gnu.org
@ 2021-03-07 20:28 ` anlauf at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-03-07 20:28 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #9 from anlauf at gcc dot gnu.org ---
Fixed on all open branches.  Closing.

Thanks for the report!

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-03-07 20:28 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-23 14:16 [Bug fortran/99218] New: matmul on temporary array accesses invalid memory (segfault) 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
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

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).