From: Steven G. Kargl Date: Sat, 15 Jun 2019 22:10:54 +0000 (+0000) Subject: decl.c (gfc_match_derived_decl): Dummy argument cannot be a derived type. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e00e19541456556b2b8d5aff9a0561d528087b27;p=gcc.git decl.c (gfc_match_derived_decl): Dummy argument cannot be a derived type. 2019-06-15 Steven G. Kargl * decl.c (gfc_match_derived_decl): Dummy argument cannot be a derived type. 2019-06-15 Steven G. Kargl * gfortran.dg/dummy_derived_typed.f90: New test. From-SVN: r272333 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index ddb2353e44c..921a6fca551 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2019-06-15 Steven G. Kargl + + * decl.c (gfc_match_derived_decl): Dummy argument cannot be a derived + type. + 2019-06-14 Steven G. Kargl * arith.c (arith_power): Rework overflow of an integer to an integer diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 1c785a4f74c..5fc06e48f2d 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -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)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 411d4966765..3a1a1e7e984 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-06-15 Steven G. Kargl + + * gfortran.dg/dummy_derived_typed.f90: New test. + 2019-06-15 Jan Hubicka * 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 index 00000000000..5c9b3ca1818 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/dummy_derived_typed.f90 @@ -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