decl.c (gfc_match_derived_decl): Dummy argument cannot be a derived type.
authorSteven G. Kargl <kargl@gcc.gnu.org>
Sat, 15 Jun 2019 22:10:54 +0000 (22:10 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Sat, 15 Jun 2019 22:10:54 +0000 (22:10 +0000)
2019-06-15  Steven G. Kargl  <kargl@gcc.gnu.org>

* decl.c (gfc_match_derived_decl): Dummy argument cannot be a derived
 type.

2019-06-15  Steven G. Kargl  <kargl@gcc.gnu.org>

* gfortran.dg/dummy_derived_typed.f90: New test.

From-SVN: r272333

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

index ddb2353e44c93480ed96eea0cfb16e1afdec39d0..921a6fca551eaf5e52d41b0a0a610902c61870d0 100644 (file)
@@ -1,3 +1,8 @@
+2019-06-15  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       * decl.c (gfc_match_derived_decl): Dummy argument cannot be a derived
+       type.
+
 2019-06-14  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        * arith.c (arith_power): Rework overflow of an integer to an integer
index 1c785a4f74c85d424d0928683f17f1b875fdfeeb..5fc06e48f2de65b62c36898ea605debc4790ba43 100644 (file)
@@ -10193,6 +10193,13 @@ gfc_match_derived_decl (void)
       && !gfc_add_function (&gensym->attr, gensym->name, NULL))
     return MATCH_ERROR;
 
+  if (gensym->attr.dummy)
+    {
+      gfc_error ("Dummy argument %qs at %L cannot be a derived type at %C",
+                name, &gensym->declared_at);
+      return MATCH_ERROR;
+    }
+
   sym = gfc_find_dt_in_generic (gensym);
 
   if (sym && (sym->components != NULL || sym->attr.zero_comp))
index 411d4966765fad8be694b1073f2f71f9df50708a..3a1a1e7e9840001c304b2cea21ce778eb3b5b82b 100644 (file)
@@ -1,3 +1,7 @@
+2019-06-15  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       * gfortran.dg/dummy_derived_typed.f90: New test.
+
 2019-06-15  Jan Hubicka  <hubicka@ucw.cz>
 
        * gcc.dg/tree-ssa/alias-access-path-2.c: New testcase.
diff --git a/gcc/testsuite/gfortran.dg/dummy_derived_typed.f90 b/gcc/testsuite/gfortran.dg/dummy_derived_typed.f90
new file mode 100644 (file)
index 0000000..5c9b3ca
--- /dev/null
@@ -0,0 +1,5 @@
+! { dg-do compile }
+subroutine s(t)   ! { dg-error "Dummy argument" }
+   type t         ! { dg-error "cannot be a derived" }
+   end type       ! { dg-error "Expecting END SUBROUTINE" }
+end