public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Sandra Loosemore <sandra@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-3828] Fortran: diagnostic for argument w/type parameters for assumed-type dummy
Date: Thu, 23 Sep 2021 00:11:41 +0000 (GMT)	[thread overview]
Message-ID: <20210923001141.73AC53858036@sourceware.org> (raw)

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


                 reply	other threads:[~2021-09-23  0:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210923001141.73AC53858036@sourceware.org \
    --to=sandra@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).