https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78593
Bug ID: 78593
Summary: ICE in gfc_match_varspec, at fortran/primary.c:2053
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: [email protected]
Target Milestone: ---
Invalid code with a hidden type declaration.
Affects version 6 and 7 (configured with --enable-checking=yes)
(bailed out if configured with --enable-checking=release).
No ICE (or bailing out) seen with version 5 and older.
$ cat z1.f90
module m1
private
type t
integer :: a
end type
end
module m2
use m1
interface operator(+)
module procedure add
end interface
contains
type(t) function add (x, y)
type(t), intent(in) :: x, y
add%a = x%a + y%a
end
end
$ gfortran-7-20161127 -c z1.f90
z1.f90:15:13:
type(t), intent(in) :: x, y
1
Error: Derived type 't' at (1) is being used before it is defined
f951: internal compiler error: Segmentation fault
0xc4532f crash_signal
../../gcc/toplev.c:333
0x6e97dc gfc_match_varspec(gfc_expr*, int, bool, bool)
../../gcc/fortran/primary.c:2053
0x6eb136 gfc_match_rvalue(gfc_expr**)
../../gcc/fortran/primary.c:3335
0x6c237e match_primary
../../gcc/fortran/matchexp.c:157
0x6c237e match_level_1
../../gcc/fortran/matchexp.c:211
0x6c237e match_mult_operand
../../gcc/fortran/matchexp.c:267
0x6c25c8 match_add_operand
../../gcc/fortran/matchexp.c:356
0x6c285c match_level_2
../../gcc/fortran/matchexp.c:480
0x6c29b2 match_level_3
../../gcc/fortran/matchexp.c:551
0x6c2ac4 match_level_4
../../gcc/fortran/matchexp.c:599
0x6c2ac4 match_and_operand
../../gcc/fortran/matchexp.c:693
0x6c2c82 match_or_operand
../../gcc/fortran/matchexp.c:722
0x6c2d72 match_equiv_operand
../../gcc/fortran/matchexp.c:765
0x6c2e62 match_level_5
../../gcc/fortran/matchexp.c:811
0x6c21d1 gfc_match_expr(gfc_expr**)
../../gcc/fortran/matchexp.c:870
0x6bb534 gfc_match(char const*, ...)
../../gcc/fortran/match.c:1162
0x6c11f0 gfc_match_ptr_fcn_assign()
../../gcc/fortran/match.c:5504
0x6db919 match_word_omp_simd
../../gcc/fortran/parse.c:93
0x6deeae match_word
../../gcc/fortran/parse.c:365
0x6deeae decode_statement
../../gcc/fortran/parse.c:374