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

            Bug ID: 107423
           Summary: ICE in parse_spec, at fortran/parse.cc:4017
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gs...@t-online.de
  Target Milestone: ---

Affects versions down to r8 with option -std=f95
and file gfortran.dg/pdt_12.f03 or this reduction :


$ cat z1.f90
program p
   type t(k)
      integer, kind :: k
      integer :: a
   end type
contains
   function f()
      type(t(4)), allocatable :: x
      allocate (t(4) :: x)
   end
end


$ gfortran-13-20221023 -c z1.f90
$
$ gfortran-13-20221023 -c z1.f90 -std=f95
z1.f90:3:23:

    3 |       integer, kind :: k
      |                       1
Error: Fortran 2003: KIND attribute at (1) in a TYPE definition
z1.f90:8:15:

    8 |       type(t(4)), allocatable :: x
      |               1
Error: Invalid character in name at (1)
z1.f90:9:18:

    9 |       allocate (t(4) :: x)
      |                  1
Error: Derived type 't' cannot be used as a variable at (1)
z1.f90:10:6:

   10 |    end
      |      1
Error: Fortran 2008: END statement instead of END FUNCTION statement at (1)
z1.f90:11:3:

   11 | end
      |   1
Error: Fortran 2008: END statement instead of END FUNCTION statement at (1)
f951: internal compiler error: Segmentation fault
0xf43b3f crash_signal
        ../../gcc/toplev.cc:314
0x85c4de parse_spec
        ../../gcc/fortran/parse.cc:4017
0x85ea5c parse_progunit
        ../../gcc/fortran/parse.cc:6237
0x85ee41 parse_contained
        ../../gcc/fortran/parse.cc:6138
0x85ece6 parse_progunit
        ../../gcc/fortran/parse.cc:6309
0x860121 gfc_parse_file()
        ../../gcc/fortran/parse.cc:6782
0x8aec0f gfc_be_parse_file
        ../../gcc/fortran/f95-lang.cc:229

Reply via email to