Fortran : Bogus error with additional blanks in type(*) PR95829
authorMark Eggleston <markeggleston@gcc.gnu.org>
Tue, 23 Jun 2020 10:01:28 +0000 (11:01 +0100)
committerMark Eggleston <markeggleston@gcc.gnu.org>
Wed, 1 Jul 2020 09:14:06 +0000 (10:14 +0100)
Checking for "* ) " instead of "*)" clears the bogus error.

2020-07-01  Steven G. Kargl  <kargl@gcc.gnu.org>

gcc/fortran/

PR fortran/95829
* decl.c (gfc_match_decl_type_spec): Compare with "* ) " instead
of "*)".

2020-07-01  Mark Eggleston  <markeggleston@gcc.gnu.org>

gcc/testsuite/

PR fortran/95829
* gfortran.dg/pr95829.f90: New test.

gcc/fortran/decl.c
gcc/testsuite/gfortran.dg/pr95829.f90 [new file with mode: 0644]

index f38def4c291470f5964611f16d42f7760f3c0db0..e16b96f6a49896613a59bdcd6b1423fa0eb524c1 100644 (file)
@@ -4128,7 +4128,7 @@ gfc_match_decl_type_spec (gfc_typespec *ts, int implicit_flag)
       gfc_gobble_whitespace ();
       if (gfc_peek_ascii_char () == '*')
        {
-         if ((m = gfc_match ("*)")) != MATCH_YES)
+         if ((m = gfc_match ("* ) ")) != MATCH_YES)
            return m;
          if (gfc_comp_struct (gfc_current_state ()))
            {
diff --git a/gcc/testsuite/gfortran.dg/pr95829.f90 b/gcc/testsuite/gfortran.dg/pr95829.f90
new file mode 100644 (file)
index 0000000..081d647
--- /dev/null
@@ -0,0 +1,14 @@
+! { dg-do compile }
+!
+! Declaration of b used to be a bogus failure.
+
+subroutine s (a, b, c, d, e, f, g)
+  type(*) :: a
+  type(* ) :: b
+  type( *) :: c
+  type( * ) :: d
+  type(*  ) :: e
+  type(  *) :: f
+  type(  *  ) :: g
+end
+