This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[Committed,fortran] Dummy argument can't be derived type
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Sat, 15 Jun 2019 15:13:21 -0700
- Subject: [Committed,fortran] Dummy argument can't be derived type
- Reply-to: sgk at troutmask dot apl dot washington dot edu
I have committed the attach patch after testing on
i586-*-freebsd and x86_64-*-freebsd.
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.
--
Steve
Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c (revision 272332)
+++ gcc/fortran/decl.c (working copy)
@@ -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: gcc/testsuite/gfortran.dg/dummy_derived_typed.f90
===================================================================
--- gcc/testsuite/gfortran.dg/dummy_derived_typed.f90 (nonexistent)
+++ gcc/testsuite/gfortran.dg/dummy_derived_typed.f90 (working copy)
@@ -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