public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-3828] Fortran: diagnostic for argument w/type parameters for assumed-type dummy
@ 2021-09-23  0:11 Sandra Loosemore
  0 siblings, 0 replies; only message in thread
From: Sandra Loosemore @ 2021-09-23  0:11 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:5098e7077bfcace3e80144e63c81be94546ced16

commit r12-3828-g5098e7077bfcace3e80144e63c81be94546ced16
Author: Sandra Loosemore <sandra@codesourcery.com>
Date:   Wed Sep 22 07:49:17 2021 -0700

    Fortran: diagnostic for argument w/type parameters for assumed-type dummy
    
    2021-09-22  Sandra Loosemore  <sandra@codesourcery.com>
    
            PR fortran/101319
    
    gcc/fortran/
            * interface.c (gfc_compare_actual_formal): Extend existing
            assumed-type diagnostic to also check for argument with type
            parameters.
    
    gcc/testsuite/
            * gfortran.dg/c-interop/assumed-type-dummy.f90: Remove xfail.

Diff:
---
 gcc/fortran/interface.c                              | 20 ++++++++++----------
 .../gfortran.dg/c-interop/assumed-type-dummy.f90     |  2 +-
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index f9a7c9ca6f8..dae4b959252 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -3183,21 +3183,21 @@ gfc_compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
 			      is_elemental, where))
 	return false;
 
-      /* TS 29113, 6.3p2.  */
+      /* TS 29113, 6.3p2; F2018 15.5.2.4.  */
       if (f->sym->ts.type == BT_ASSUMED
 	  && (a->expr->ts.type == BT_DERIVED
 	      || (a->expr->ts.type == BT_CLASS && CLASS_DATA (a->expr))))
 	{
-	  gfc_namespace *f2k_derived;
-
-	  f2k_derived = a->expr->ts.type == BT_DERIVED
-			? a->expr->ts.u.derived->f2k_derived
-			: CLASS_DATA (a->expr)->ts.u.derived->f2k_derived;
-
-	  if (f2k_derived
-	      && (f2k_derived->finalizers || f2k_derived->tb_sym_root))
+	  gfc_symbol *derived = (a->expr->ts.type == BT_DERIVED
+				 ? a->expr->ts.u.derived
+				 : CLASS_DATA (a->expr)->ts.u.derived);
+	  gfc_namespace *f2k_derived = derived->f2k_derived;
+	  if (derived->attr.pdt_type
+	      || (f2k_derived
+		  && (f2k_derived->finalizers || f2k_derived->tb_sym_root)))
 	    {
-	      gfc_error ("Actual argument at %L to assumed-type dummy is of "
+	      gfc_error ("Actual argument at %L to assumed-type dummy "
+			 "has type parameters or is of "
 			 "derived type with type-bound or FINAL procedures",
 			 &a->expr->where);
 	      return false;
diff --git a/gcc/testsuite/gfortran.dg/c-interop/assumed-type-dummy.f90 b/gcc/testsuite/gfortran.dg/c-interop/assumed-type-dummy.f90
index a14c9a59703..24bdf2bae0c 100644
--- a/gcc/testsuite/gfortran.dg/c-interop/assumed-type-dummy.f90
+++ b/gcc/testsuite/gfortran.dg/c-interop/assumed-type-dummy.f90
@@ -73,7 +73,7 @@ contains
     type(t4) :: a4
 
     call s1 (a1)  ! OK
-    call s1 (a2)  ! { dg-error "assumed-type dummy" "pr101319" { xfail *-*-* } }
+    call s1 (a2)  ! { dg-error "assumed-type dummy" }
     call s1 (a3)  ! { dg-error "assumed-type dummy" }
     call s1 (a4)  ! { dg-error "assumed-type dummy" }
   end subroutine


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-23  0:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-23  0:11 [gcc r12-3828] Fortran: diagnostic for argument w/type parameters for assumed-type dummy Sandra Loosemore

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).