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

            Bug ID: 80118
           Summary: ICE with zero size parameter array
           Product: gcc
           Version: 7.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mrestelli at gmail dot com
  Target Milestone: ---

The following code produces an internal compiler error when
referring to "empty2".

module m
implicit none

  integer, parameter :: not_empty(1) = 0
  integer, parameter :: empty1(0) = (/integer :: /)
  integer, parameter :: empty2(0) = 0

contains

 subroutine sub(v)
  integer, allocatable, intent(out) :: v(:)
   v = 2*not_empty ! works
   v = 2*empty1    ! works
   v = 2*empty2 ! internal compiler error
 end subroutine sub

end module m



$ gfortran -c test.f90 -o test.o
test.f90:14:0:

    v = 2*empty2 ! internal compiler error

internal compiler error: Errore di segmentazione
0xa6f07f crash_signal
        .././../gcc-trunk-source/gcc/toplev.c:337
0x5c9519 gfc_get_full_arrayspec_from_expr(gfc_expr*)
        .././../gcc-trunk-source/gcc/fortran/expr.c:4496
0x6700c6 gfc_alloc_allocatable_for_assignment(gfc_loopinfo*, gfc_expr*,
gfc_expr*)
        .././../gcc-trunk-source/gcc/fortran/trans-array.c:9127
0x69b0c3 gfc_trans_assignment_1
        .././../gcc-trunk-source/gcc/fortran/trans-expr.c:10131
0x66051f trans_code
        .././../gcc-trunk-source/gcc/fortran/trans.c:1817
0x6856f7 gfc_generate_function_code(gfc_namespace*)
        .././../gcc-trunk-source/gcc/fortran/trans-decl.c:6332
0x6641b1 gfc_generate_module_code(gfc_namespace*)
        .././../gcc-trunk-source/gcc/fortran/trans.c:2195
0x61a36b translate_all_program_units
        .././../gcc-trunk-source/gcc/fortran/parse.c:6061
0x61a36b gfc_parse_file()
        .././../gcc-trunk-source/gcc/fortran/parse.c:6274
0x65d05f gfc_be_parse_file
        .././../gcc-trunk-source/gcc/fortran/f95-lang.c:204
Please submit a full bug report,
with preprocessed source if appropriate.



gfortran --version
GNU Fortran (GCC) 7.0.1 20170317 (experimental)

Reply via email to