[Bug fortran/88206] [7/8/9 Regression] ICE in gfc_match_type_spec, at fortran/match.c:2229
kargl at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Dec 1 00:05:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88206
--- Comment #3 from kargl at gcc dot gnu.org ---
(In reply to G. Steinmetz from comment #0)
> Affects versions 7,8,9 :
>
>
> $ cat z1.f90
> program p
> integer, parameter :: z(4) = [1,2,3,4]
> integer :: k = 2
> print *, [real(z(k))]
> end
>
>
> $ gfortran-6 -c z1.f90
> $
> $ gfortran-9-20181125 -c z1.f90
> f951: internal compiler error: Segmentation fault
> 0xb2bcff crash_signal
> ../../gcc/toplev.c:326
> 0x64ba3f gfc_match_type_spec(gfc_typespec*)
> ../../gcc/fortran/match.c:2229
Index: gcc/fortran/match.c
===================================================================
--- gcc/fortran/match.c (revision 266386)
+++ gcc/fortran/match.c (working copy)
@@ -2225,6 +2225,9 @@ found:
return MATCH_NO;
}
+ if (e->expr_type != EXPR_CONSTANT)
+ goto ohno;
+
gfc_next_char (); /* Burn the ')'. */
ts->kind = (int) mpz_get_si (e->value.integer);
if (gfc_validate_kind (ts->type, ts->kind , true) == -1)
@@ -2238,6 +2241,8 @@ found:
return MATCH_YES;
}
}
+
+ohno:
/* If a type is not matched, simply return MATCH_NO. */
gfc_current_locus = old_locus;
More information about the Gcc-bugs
mailing list