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

            Bug ID: 77915
           Summary: Internal error for matmul() in forall with
                    optimization
           Product: gcc
           Version: 6.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hroch at physics dot muni.cz
  Target Milestone: ---

Dear colleagues,

I encountered an internal problem in gfortran
compiler for matmul() in forall loop, while
optimization is switched on.

There is a minimal code:
---
program x
  integer, parameter :: d = 3
  real,dimension(d,d,d) :: cube,xcube
  real, dimension(d,d) :: cmatrix
  integer :: i,j
  forall(i=1:d,j=1:d)
     xcube(i,j,:) = matmul(cmatrix,cube(i,j,:))
  end forall
end program x
---

which works correctly for

 $ gfortran f.f95

while with optimization flag

 $ gfortran -O f.f95

fails on:

---
f.f95:6:0:

   forall(i=1:d,j=1:d)

internal compiler error: in gfc_trans_forall_1, at fortran/trans-stmt.c:4388
0x6edc26 gfc_trans_forall_1
        ../../src/gcc/fortran/trans-stmt.c:4388
0x68dfd7 trans_code
        ../../src/gcc/fortran/trans.c:1832
0x6b167c gfc_generate_function_code(gfc_namespace*)
        ../../src/gcc/fortran/trans-decl.c:6167
0x649b90 translate_all_program_units
        ../../src/gcc/fortran/parse.c:5915
0x649b90 gfc_parse_file()
        ../../src/gcc/fortran/parse.c:6121
0x68b322 gfc_be_parse_file
        ../../src/gcc/fortran/f95-lang.c:201
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-6/README.Bugs> for instructions.
---

The compiler version is

 $ gfortran --version
GNU Fortran (Debian 6.2.0-5) 6.2.0 20160927
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOS

which is from latest GNU/Debian (unstable) compiler collection.
Older compilers (GNU Fortran (Debian 4.9.2-10) 4.9.2) works
correctly. Use of both '-O -finline-matmul-limit=0' is also
successful.


Thank you for developing of gfortran!

Reply via email to