From: Steven G. Kargl Date: Sun, 9 Dec 2018 19:10:57 +0000 (+0000) Subject: re PR fortran/88206 (ICE in gfc_match_type_spec, at fortran/match.c:2229) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6dc5aacf971328602dcbf278b6a6ed2cbb6dc99a;p=gcc.git re PR fortran/88206 (ICE in gfc_match_type_spec, at fortran/match.c:2229) 2018-12-09 Steven G. Kargl PR fortran/88206 * match.c (gfc_match_type_spec): REAL can be an intrinsic function. 2018-12-09 Steven G. Kargl PR fortran/88206 * gfortran.dg/pr88206.f90: New test. From-SVN: r266930 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index f37ca637fa0..f5c2f01bab4 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2018-12-09 Steven G. Kargl + + PR fortran/88206 + * match.c (gfc_match_type_spec): REAL can be an intrinsic function. + 2018-12-09 Fritz Reese PR fortran/88228 diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index f22241da60b..d548bb92c2d 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -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) @@ -2239,6 +2242,8 @@ found: } } +ohno: + /* If a type is not matched, simply return MATCH_NO. */ gfc_current_locus = old_locus; return MATCH_NO; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 120fb9e1308..aac29ffe614 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-12-09 Steven G. Kargl + + PR fortran/88206 + * gfortran.dg/pr88206.f90: New test. + 2018-12-09 Steven G. Kargl PR fortran/88228 diff --git a/gcc/testsuite/gfortran.dg/pr88206.f90 b/gcc/testsuite/gfortran.dg/pr88206.f90 new file mode 100644 index 00000000000..71c61f06098 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr88206.f90 @@ -0,0 +1,8 @@ +! { dg-do compile } +! PR fortran/88206 +program p + integer, parameter :: z(4) = [1,2,3,4] + integer :: k = 2 + print *, [real(z(k))] +end +