public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/99839] New: ICE in inline_matmul_assign, at fortran/frontend-passes.c:4234
@ 2021-03-30 19:12 gscfq@t-online.de
  2021-03-30 20:07 ` [Bug fortran/99839] " anlauf at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: gscfq@t-online.de @ 2021-03-30 19:12 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99839
           Summary: ICE in inline_matmul_assign, at
                    fortran/frontend-passes.c:4234
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

Affects versions down to r7, at -O1+ :


$ cat z1.f90
program p
   real :: x(3, 3) = 1.0
   class(*), allocatable :: z(:, :)
   z = matmul(x, x)
end


$ gfortran-11-20210328 -c z1.f90 -O0
$ 
$ gfortran-11-20210328 -c z1.f90 -O2
f951: internal compiler error: in inline_matmul_assign, at
fortran/frontend-passes.c:4234
0x7bf248 inline_matmul_assign
        ../../gcc/fortran/frontend-passes.c:4234
0x7bfd69 gfc_code_walker(gfc_code**, int (*)(gfc_code**, int*, void*), int
(*)(gfc_expr**, int*, void*), void*)
        ../../gcc/fortran/frontend-passes.c:5320
0x7c1172 optimize_namespace
        ../../gcc/fortran/frontend-passes.c:1500
0x7c154f gfc_run_passes(gfc_namespace*)
        ../../gcc/fortran/frontend-passes.c:169
0x6fd1a7 gfc_resolve(gfc_namespace*)
        ../../gcc/fortran/resolve.c:17436
0x6e56e4 resolve_all_program_units
        ../../gcc/fortran/parse.c:6290
0x6e56e4 gfc_parse_file()
        ../../gcc/fortran/parse.c:6542
0x7320ef gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:212

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

* [Bug fortran/99839] ICE in inline_matmul_assign, at fortran/frontend-passes.c:4234
  2021-03-30 19:12 [Bug fortran/99839] New: ICE in inline_matmul_assign, at fortran/frontend-passes.c:4234 gscfq@t-online.de
@ 2021-03-30 20:07 ` anlauf at gcc dot gnu.org
  2021-03-30 20:10 ` [Bug fortran/99839] [8/9/10/11 Regression] " 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-03-30 20:07 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
                 CC|                            |anlauf at gcc dot gnu.org,
                   |                            |tkoenig at gcc dot gnu.org
   Last reconfirmed|                            |2021-03-30
     Ever confirmed|0                           |1
           Priority|P3                          |P4

--- Comment #1 from anlauf at gcc dot gnu.org ---
This one is funny.  Simply punting on non-numeric and non-logical results
works around the ICE.

diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c
index 7d3eae67632..213530e46e1 100644
--- a/gcc/fortran/frontend-passes.c
+++ b/gcc/fortran/frontend-passes.c
@@ -4193,6 +4193,19 @@ inline_matmul_assign (gfc_code **c, int *walk_subtrees,
   if (m_case == none)
     return 0;

+  /* We only handle assignment to numeric or logical variables.  */
+  switch(expr1->ts.type)
+    {
+    case BT_INTEGER:
+    case BT_LOGICAL:
+    case BT_REAL:
+    case BT_COMPLEX:
+      break;
+
+    default:
+      return 0;
+    }
+
   ns = insert_block ();

   /* Assign the type of the zero expression for initializing the resulting

Adding Thomas, who knows the code better.

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

* [Bug fortran/99839] [8/9/10/11 Regression] ICE in inline_matmul_assign, at fortran/frontend-passes.c:4234
  2021-03-30 19:12 [Bug fortran/99839] New: ICE in inline_matmul_assign, at fortran/frontend-passes.c:4234 gscfq@t-online.de
  2021-03-30 20:07 ` [Bug fortran/99839] " anlauf at gcc dot gnu.org
@ 2021-03-30 20:10 ` anlauf at gcc dot gnu.org
  2021-03-31 12:53 ` marxin at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-03-30 20:10 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |8.5
            Summary|ICE in                      |[8/9/10/11 Regression] ICE
                   |inline_matmul_assign, at    |in inline_matmul_assign, at
                   |fortran/frontend-passes.c:4 |fortran/frontend-passes.c:4
                   |234                         |234

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

* [Bug fortran/99839] [8/9/10/11 Regression] ICE in inline_matmul_assign, at fortran/frontend-passes.c:4234
  2021-03-30 19:12 [Bug fortran/99839] New: ICE in inline_matmul_assign, at fortran/frontend-passes.c:4234 gscfq@t-online.de
  2021-03-30 20:07 ` [Bug fortran/99839] " anlauf at gcc dot gnu.org
  2021-03-30 20:10 ` [Bug fortran/99839] [8/9/10/11 Regression] " anlauf at gcc dot gnu.org
@ 2021-03-31 12:53 ` marxin at gcc dot gnu.org
  2021-05-14  9:54 ` [Bug fortran/99839] [9/10/11/12 " jakub at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-03-31 12:53 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Btw. started with r6-523-gf1abbf6901a64919.

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

* [Bug fortran/99839] [9/10/11/12 Regression] ICE in inline_matmul_assign, at fortran/frontend-passes.c:4234
  2021-03-30 19:12 [Bug fortran/99839] New: ICE in inline_matmul_assign, at fortran/frontend-passes.c:4234 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2021-03-31 12:53 ` marxin at gcc dot gnu.org
@ 2021-05-14  9:54 ` jakub at gcc dot gnu.org
  2021-05-27 20:21 ` anlauf at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-05-14  9:54 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|8.5                         |9.4

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 8 branch is being closed.

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

* [Bug fortran/99839] [9/10/11/12 Regression] ICE in inline_matmul_assign, at fortran/frontend-passes.c:4234
  2021-03-30 19:12 [Bug fortran/99839] New: ICE in inline_matmul_assign, at fortran/frontend-passes.c:4234 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2021-05-14  9:54 ` [Bug fortran/99839] [9/10/11/12 " jakub at gcc dot gnu.org
@ 2021-05-27 20:21 ` anlauf at gcc dot gnu.org
  2021-06-01  8:20 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-05-27 20:21 UTC (permalink / raw)
  To: gcc-bugs

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

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-May/056095.html

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

* [Bug fortran/99839] [9/10/11/12 Regression] ICE in inline_matmul_assign, at fortran/frontend-passes.c:4234
  2021-03-30 19:12 [Bug fortran/99839] New: ICE in inline_matmul_assign, at fortran/frontend-passes.c:4234 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2021-05-27 20:21 ` anlauf at gcc dot gnu.org
@ 2021-06-01  8:20 ` rguenth at gcc dot gnu.org
  2021-06-04 17:24 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-01  8:20 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.4                         |9.5

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9.4 is being released, retargeting bugs to GCC 9.5.

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

* [Bug fortran/99839] [9/10/11/12 Regression] ICE in inline_matmul_assign, at fortran/frontend-passes.c:4234
  2021-03-30 19:12 [Bug fortran/99839] New: ICE in inline_matmul_assign, at fortran/frontend-passes.c:4234 gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2021-06-01  8:20 ` rguenth at gcc dot gnu.org
@ 2021-06-04 17:24 ` cvs-commit at gcc dot gnu.org
  2021-06-04 17:42 ` 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-06-04 17:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 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:bee8619ad0ac3bd27b7c8dc5819b83a5e8e147a0

commit r12-1222-gbee8619ad0ac3bd27b7c8dc5819b83a5e8e147a0
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Fri Jun 4 19:23:48 2021 +0200

    Fortran - ICE in inline_matmul_assign

    Restrict inlining of matmul to those cases where assignment to the
    result array does not need special treatment.

    gcc/fortran/ChangeLog:

            PR fortran/99839
            * frontend-passes.c (inline_matmul_assign): Do not inline matmul
            if the assignment to the resulting array if it is not of canonical
            type (real/integer/complex/logical).

    gcc/testsuite/ChangeLog:

            PR fortran/99839
            * gfortran.dg/inline_matmul_25.f90: New test.

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

* [Bug fortran/99839] [9/10/11/12 Regression] ICE in inline_matmul_assign, at fortran/frontend-passes.c:4234
  2021-03-30 19:12 [Bug fortran/99839] New: ICE in inline_matmul_assign, at fortran/frontend-passes.c:4234 gscfq@t-online.de
                   ` (6 preceding siblings ...)
  2021-06-04 17:24 ` cvs-commit at gcc dot gnu.org
@ 2021-06-04 17:42 ` cvs-commit at gcc dot gnu.org
  2021-06-04 17:54 ` 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-06-04 17:42 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:2fdca7cfda7d49f3b252e79acc5933d764e7b77d

commit r11-8511-g2fdca7cfda7d49f3b252e79acc5933d764e7b77d
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Fri Jun 4 19:23:48 2021 +0200

    Fortran - ICE in inline_matmul_assign

    Restrict inlining of matmul to those cases where assignment to the
    result array does not need special treatment.

    gcc/fortran/ChangeLog:

            PR fortran/99839
            * frontend-passes.c (inline_matmul_assign): Do not inline matmul
            if the assignment to the resulting array if it is not of canonical
            type (real/integer/complex/logical).

    gcc/testsuite/ChangeLog:

            PR fortran/99839
            * gfortran.dg/inline_matmul_25.f90: New test.

    (cherry picked from commit bee8619ad0ac3bd27b7c8dc5819b83a5e8e147a0)

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

* [Bug fortran/99839] [9/10/11/12 Regression] ICE in inline_matmul_assign, at fortran/frontend-passes.c:4234
  2021-03-30 19:12 [Bug fortran/99839] New: ICE in inline_matmul_assign, at fortran/frontend-passes.c:4234 gscfq@t-online.de
                   ` (7 preceding siblings ...)
  2021-06-04 17:42 ` cvs-commit at gcc dot gnu.org
@ 2021-06-04 17:54 ` cvs-commit at gcc dot gnu.org
  2021-06-04 18:19 ` cvs-commit at gcc dot gnu.org
  2021-06-04 18:22 ` anlauf at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-04 17:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 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:df45c5b83447a06e6b15c729807a17409c39ddff

commit r10-9890-gdf45c5b83447a06e6b15c729807a17409c39ddff
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Fri Jun 4 19:23:48 2021 +0200

    Fortran - ICE in inline_matmul_assign

    Restrict inlining of matmul to those cases where assignment to the
    result array does not need special treatment.

    gcc/fortran/ChangeLog:

            PR fortran/99839
            * frontend-passes.c (inline_matmul_assign): Do not inline matmul
            if the assignment to the resulting array if it is not of canonical
            type (real/integer/complex/logical).

    gcc/testsuite/ChangeLog:

            PR fortran/99839
            * gfortran.dg/inline_matmul_25.f90: New test.

    (cherry picked from commit bee8619ad0ac3bd27b7c8dc5819b83a5e8e147a0)

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

* [Bug fortran/99839] [9/10/11/12 Regression] ICE in inline_matmul_assign, at fortran/frontend-passes.c:4234
  2021-03-30 19:12 [Bug fortran/99839] New: ICE in inline_matmul_assign, at fortran/frontend-passes.c:4234 gscfq@t-online.de
                   ` (8 preceding siblings ...)
  2021-06-04 17:54 ` cvs-commit at gcc dot gnu.org
@ 2021-06-04 18:19 ` cvs-commit at gcc dot gnu.org
  2021-06-04 18:22 ` anlauf at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-04 18:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 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:e912880888f9529eb44e3456c4753fc556c63812

commit r9-9568-ge912880888f9529eb44e3456c4753fc556c63812
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Fri Jun 4 19:23:48 2021 +0200

    Fortran - ICE in inline_matmul_assign

    Restrict inlining of matmul to those cases where assignment to the
    result array does not need special treatment.

    gcc/fortran/ChangeLog:

            PR fortran/99839
            * frontend-passes.c (inline_matmul_assign): Do not inline matmul
            if the assignment to the resulting array if it is not of canonical
            type (real/integer/complex/logical).

    gcc/testsuite/ChangeLog:

            PR fortran/99839
            * gfortran.dg/inline_matmul_25.f90: New test.

    (cherry picked from commit bee8619ad0ac3bd27b7c8dc5819b83a5e8e147a0)

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

* [Bug fortran/99839] [9/10/11/12 Regression] ICE in inline_matmul_assign, at fortran/frontend-passes.c:4234
  2021-03-30 19:12 [Bug fortran/99839] New: ICE in inline_matmul_assign, at fortran/frontend-passes.c:4234 gscfq@t-online.de
                   ` (9 preceding siblings ...)
  2021-06-04 18:19 ` cvs-commit at gcc dot gnu.org
@ 2021-06-04 18:22 ` anlauf at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-06-04 18:22 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #10 from anlauf at gcc dot gnu.org ---
Fixed on mainline for gcc-12, and committed on 11-, 10- and 9-branch.  Closing.

Thanks for the report!

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

end of thread, other threads:[~2021-06-04 18:22 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-30 19:12 [Bug fortran/99839] New: ICE in inline_matmul_assign, at fortran/frontend-passes.c:4234 gscfq@t-online.de
2021-03-30 20:07 ` [Bug fortran/99839] " anlauf at gcc dot gnu.org
2021-03-30 20:10 ` [Bug fortran/99839] [8/9/10/11 Regression] " anlauf at gcc dot gnu.org
2021-03-31 12:53 ` marxin at gcc dot gnu.org
2021-05-14  9:54 ` [Bug fortran/99839] [9/10/11/12 " jakub at gcc dot gnu.org
2021-05-27 20:21 ` anlauf at gcc dot gnu.org
2021-06-01  8:20 ` rguenth at gcc dot gnu.org
2021-06-04 17:24 ` cvs-commit at gcc dot gnu.org
2021-06-04 17:42 ` cvs-commit at gcc dot gnu.org
2021-06-04 17:54 ` cvs-commit at gcc dot gnu.org
2021-06-04 18:19 ` cvs-commit at gcc dot gnu.org
2021-06-04 18:22 ` 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).