From: Steven G. Kargl Date: Fri, 11 Oct 2019 20:19:28 +0000 (+0000) Subject: re PR fortran/91715 (ICE in resolve_fntype, at fortran/resolve.c:16884) X-Git-Tag: releases/gcc-9.3.0~555 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a0368cad1d5e7a69035b4b5117167116c3259af4;p=thirdparty%2Fgcc.git re PR fortran/91715 (ICE in resolve_fntype, at fortran/resolve.c:16884) 2019-10-11 Steven G. Kargl PR fortran/91715 * decl.c (gfc_match_prefix): If matching a type-spec returns an error, it's an error so re-act correctly. 2019-10-11 Steven G. Kargl PR fortran/91715 * gfortran.dg/function_kinds_5.f90: Prune run-on error. * gfortran.dg/pr85543.f90: Ditto. * gfortran.dg/pr91715.f90: New test. From-SVN: r276905 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index dbdbdddc240a..2064cf1314b1 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2019-10-11 Steven G. Kargl + + PR fortran/91715 + * decl.c (gfc_match_prefix): If matching a type-spec returns an error, + it's an error so re-act correctly. + 2019-10-11 Steven G. Kargl PR fortran/91649 diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 9beb4eef4552..7b87bb88a30e 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -6169,13 +6169,17 @@ gfc_match_prefix (gfc_typespec *ts) found_prefix = true; } - if (!seen_type && ts != NULL - && gfc_match_decl_type_spec (ts, 0) == MATCH_YES - && gfc_match_space () == MATCH_YES) + if (!seen_type && ts != NULL) { - - seen_type = true; - found_prefix = true; + match m; + m = gfc_match_decl_type_spec (ts, 0); + if (m == MATCH_ERROR) + goto error; + if (m == MATCH_YES && gfc_match_space () == MATCH_YES) + { + seen_type = true; + found_prefix = true; + } } if (gfc_match ("elemental% ") == MATCH_YES) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8c59770df3ed..c766d548c6e9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2019-10-11 Steven G. Kargl + + PR fortran/91715 + * gfortran.dg/function_kinds_5.f90: Prune run-on error. + * gfortran.dg/pr85543.f90: Ditto. + * gfortran.dg/pr91715.f90: New test. + 2019-10-11 Steven G. Kargl PR fortran/91649 diff --git a/gcc/testsuite/gfortran.dg/function_kinds_5.f90 b/gcc/testsuite/gfortran.dg/function_kinds_5.f90 index e48484ec30dc..106431fe206c 100644 --- a/gcc/testsuite/gfortran.dg/function_kinds_5.f90 +++ b/gcc/testsuite/gfortran.dg/function_kinds_5.f90 @@ -8,3 +8,4 @@ real (bad_kind(0d0)) function foo () ! { dg-error "must be an intrinsic function" } foo = real (kind (foo)) end function +! { dg-prune-output "Bad kind expression for function" } diff --git a/gcc/testsuite/gfortran.dg/pr85543.f90 b/gcc/testsuite/gfortran.dg/pr85543.f90 index d3f83276a7f2..b0faa8d59276 100644 --- a/gcc/testsuite/gfortran.dg/pr85543.f90 +++ b/gcc/testsuite/gfortran.dg/pr85543.f90 @@ -6,3 +6,4 @@ contains real(z()) function f() ! { dg-error "in initialization expression at" } end end +! { dg-prune-output "Bad kind expression for function" } diff --git a/gcc/testsuite/gfortran.dg/pr91715.f90 b/gcc/testsuite/gfortran.dg/pr91715.f90 new file mode 100644 index 000000000000..a3d9b8d1d9a2 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr91715.f90 @@ -0,0 +1,5 @@ +! { dg-do compile } +! PR fortran/91715 +! Code contributed Gerhard Steinmetz +character(1function f() ! { dg-error "Syntax error in CHARACTER" } +end