public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Mikael Morin <mikael@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-5317] fortran: Delete redundant missing_arg_type field
Date: Tue, 16 Nov 2021 18:08:16 +0000 (GMT)	[thread overview]
Message-ID: <20211116180816.F047E385AC33@sourceware.org> (raw)

https://gcc.gnu.org/g:e94e2cf9f9b31167cfaa6e33f731c3735515662d

commit r12-5317-ge94e2cf9f9b31167cfaa6e33f731c3735515662d
Author: Mikael Morin <mikael@gcc.gnu.org>
Date:   Sun Nov 7 14:40:24 2021 +0100

    fortran: Delete redundant missing_arg_type field
    
    Now that we can get information about an actual arg's associated
    dummy using the associated_dummy attribute, the field missing_arg_type
    contains redundant information.
    This removes it.
    
    gcc/fortran/ChangeLog:
            * gfortran.h (gfc_actual_arglist::missing_arg_type): Remove.
            * interface.c (gfc_compare_actual_formal): Remove
            missing_arg_type initialization.
            * intrinsic.c (sort_actual): Ditto.
            * trans-expr.c (gfc_conv_procedure_call): Use associated_dummy
            and gfc_dummy_arg_get_typespec to get the dummy argument type.

Diff:
---
 gcc/fortran/gfortran.h   | 5 -----
 gcc/fortran/interface.c  | 5 -----
 gcc/fortran/intrinsic.c  | 5 +----
 gcc/fortran/trans-expr.c | 9 +++++++--
 4 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 4230b5ae2dc..bf617705827 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -1210,11 +1210,6 @@ typedef struct gfc_actual_arglist
   /* Alternate return label when the expr member is null.  */
   struct gfc_st_label *label;
 
-  /* This is set to the type of an eventual omitted optional
-     argument. This is used to determine if a hidden string length
-     argument has to be added to a function call.  */
-  bt missing_arg_type;
-
   gfc_param_spec_type spec_type;
 
   struct gfc_expr *expr;
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 9194fe745ed..12574f8f037 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -3715,11 +3715,6 @@ gfc_compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
   if (*ap == NULL && n > 0)
     *ap = new_arg[0];
 
-  /* Note the types of omitted optional arguments.  */
-  for (a = *ap, f = formal; a; a = a->next, f = f->next)
-    if (a->expr == NULL && a->label == NULL)
-      a->missing_arg_type = f->sym->ts.type;
-
   return true;
 }
 
diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c
index cb07326ef62..3682f9ae21f 100644
--- a/gcc/fortran/intrinsic.c
+++ b/gcc/fortran/intrinsic.c
@@ -4406,10 +4406,7 @@ do_sort:
 	}
 
       if (a == NULL)
-	{
-	  a = gfc_get_actual_arglist ();
-	  a->missing_arg_type = f->ts.type;
-	}
+	a = gfc_get_actual_arglist ();
 
       a->associated_dummy = get_intrinsic_dummy_arg (f);
 
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index e7aec3845d3..bc502c0f43c 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -6157,7 +6157,10 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
 		{
 		  /* Pass a NULL pointer for an absent arg.  */
 		  parmse.expr = null_pointer_node;
-		  if (arg->missing_arg_type == BT_CHARACTER)
+		  gfc_dummy_arg * const dummy_arg = arg->associated_dummy;
+		  if (dummy_arg
+		      && gfc_dummy_arg_get_typespec (*dummy_arg).type
+			 == BT_CHARACTER)
 		    parmse.string_length = build_int_cst (gfc_charlen_type_node,
 							  0);
 		}
@@ -6174,7 +6177,9 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
 			  || !CLASS_DATA (fsym)->attr.allocatable));
 	  gfc_init_se (&parmse, NULL);
 	  parmse.expr = null_pointer_node;
-	  if (arg->missing_arg_type == BT_CHARACTER)
+	  if (arg->associated_dummy
+	      && gfc_dummy_arg_get_typespec (*arg->associated_dummy).type
+		 == BT_CHARACTER)
 	    parmse.string_length = build_int_cst (gfc_charlen_type_node, 0);
 	}
       else if (fsym && fsym->ts.type == BT_CLASS


                 reply	other threads:[~2021-11-16 18:08 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=20211116180816.F047E385AC33@sourceware.org \
    --to=mikael@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).