diff options
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/decl.c | 16 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/function_kinds_5.f90 | 1 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/pr85543.f90 | 1 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/pr91715.f90 | 5 |
6 files changed, 30 insertions, 6 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index b6d97cb..7819bd4 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,5 +1,11 @@ 2019-10-11 Steven G. Kargl <kargl@gcc.gnu.org> + 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 <kargl@gcc.gnu.org> + PR fortran/92018 * check.c (reset_boz): New function. (illegal_boz_arg, boz_args_check, gfc_check_complex, gfc_check_float, diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 9b604c8..9cda824 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -6202,13 +6202,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 0cf04a5..b11a1bf 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,12 @@ 2019-10-11 Steven G. Kargl <kargl@gcc.gnu.org> + 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 <kargl@gcc.gnu.org> + PR fortran/92018 * gfortran.dg/gnu_logical_2.f90: Update dg-error regex. * gfortran.dg/pr81509_2.f90: Ditto. diff --git a/gcc/testsuite/gfortran.dg/function_kinds_5.f90 b/gcc/testsuite/gfortran.dg/function_kinds_5.f90 index e48484e..106431f 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 d3f8327..b0faa8d 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 0000000..a3d9b8d --- /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 |