re PR fortran/91715 (ICE in resolve_fntype, at fortran/resolve.c:16884)
authorSteven G. Kargl <kargl@gcc.gnu.org>
Fri, 11 Oct 2019 17:59:09 +0000 (17:59 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Fri, 11 Oct 2019 17:59:09 +0000 (17:59 +0000)
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/91715
* gfortran.dg/function_kinds_5.f90: Prune run-on error.
* gfortran.dg/pr85543.f90: Ditto.
* gfortran.dg/pr91715.f90: New test.

From-SVN: r276899

gcc/fortran/ChangeLog
gcc/fortran/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/function_kinds_5.f90
gcc/testsuite/gfortran.dg/pr85543.f90
gcc/testsuite/gfortran.dg/pr91715.f90 [new file with mode: 0644]

index b6d97cb3c71f521284cb6ed3ea3145c16beae0a8..7819bd4001afeb5cce3c26e98a2246f1d6978b64 100644 (file)
@@ -1,3 +1,9 @@
+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
index 9b604c8e7c34b401fb03452b03609bbf87da60e0..9cda824ac0598d180dfa3e18fea692404859f5f5 100644 (file)
@@ -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)
index 0cf04a5b3a53061f1e6cb4dc3017bf6d9c1578e5..b11a1bf7d7dcda426a13a954ea24c95cdd4b339b 100644 (file)
@@ -1,3 +1,10 @@
+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
index e48484ec30dc212705fc023c18820ac2f9f22b3d..106431fe206c9b72a1758bfa4b580bdd3cf634d6 100644 (file)
@@ -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" }
index d3f83276a7f2d173fa8719871e1ef389687e3576..b0faa8d59276e22cdac33195f023e55ec6abfd3d 100644 (file)
@@ -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 (file)
index 0000000..a3d9b8d
--- /dev/null
@@ -0,0 +1,5 @@
+! { dg-do compile }
+! PR fortran/91715
+! Code contributed Gerhard Steinmetz
+character(1function f()  ! { dg-error "Syntax error in CHARACTER" }
+end