public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mikael Morin <mikael@gcc.gnu.org>
To: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org,
	Mikael Morin <morin-mikael@orange.fr>
Subject: [PATCH 5/7] fortran: Delete redundant missing_arg_type field
Date: Tue,  3 Aug 2021 17:39:43 +0200	[thread overview]
Message-ID: <20210803153945.1309734-6-mikael@gcc.gnu.org> (raw)
In-Reply-To: <20210803153945.1309734-1-mikael@gcc.gnu.org>

[-- Attachment #1: Type: text/plain, Size: 700 bytes --]


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/
	* 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 get_typespec to get the dummy argument type.
---
 gcc/fortran/gfortran.h   | 5 -----
 gcc/fortran/interface.c  | 5 -----
 gcc/fortran/intrinsic.c  | 5 +----
 gcc/fortran/trans-expr.c | 7 +++++--
 4 files changed, 6 insertions(+), 16 deletions(-)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0005-fortran-Delete-redundant-missing_arg_type-field.patch --]
[-- Type: text/x-patch; name="0005-fortran-Delete-redundant-missing_arg_type-field.patch", Size: 2553 bytes --]

diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index edad3d9e98c..627a3480ef1 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -1166,11 +1166,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 b763f87e8bd..c51ec4c124e 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -3569,11 +3569,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 007cac053cb..8d5546ce19f 100644
--- a/gcc/fortran/intrinsic.c
+++ b/gcc/fortran/intrinsic.c
@@ -4430,10 +4430,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 = f;
 
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index b18a9ec9799..4806ebac56e 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -5831,7 +5831,9 @@ 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)
+		  if (arg->associated_dummy
+		      && arg->associated_dummy->get_typespec ().type
+			 == BT_CHARACTER)
 		    parmse.string_length = build_int_cst (gfc_charlen_type_node,
 							  0);
 		}
@@ -5848,7 +5850,8 @@ 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
+	      && arg->associated_dummy->get_typespec ().type == BT_CHARACTER)
 	    parmse.string_length = build_int_cst (gfc_charlen_type_node, 0);
 	}
       else if (fsym && fsym->ts.type == BT_CLASS

  parent reply	other threads:[~2021-08-03 15:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-03 15:39 [PATCH 0/7] fortran: Ignore unused arguments for scalarisation [PR97896] Mikael Morin
2021-08-03 15:39 ` [PATCH 1/7] fortran: new abstract class gfc_dummy_arg Mikael Morin
2021-08-04  7:05   ` Thomas Koenig
2021-08-04 18:33     ` Mikael Morin
2021-08-03 15:39 ` [PATCH 2/7] fortran: Tiny sort_actual internal refactoring Mikael Morin
2021-08-03 15:39 ` [PATCH 3/7] fortran: Reverse actual vs dummy argument mapping Mikael Morin
2021-08-03 15:39 ` [PATCH 4/7] fortran: simplify elemental arguments walking Mikael Morin
2021-08-03 15:39 ` Mikael Morin [this message]
2021-08-03 15:39 ` [PATCH 6/7] Revert "Remove KIND argument from INDEX so it does not mess up scalarization." Mikael Morin
2021-08-03 15:39 ` [PATCH 7/7] fortran: Ignore unused args in scalarization [PR97896] Mikael Morin

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=20210803153945.1309734-6-mikael@gcc.gnu.org \
    --to=mikael@gcc.gnu.org \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=morin-mikael@orange.fr \
    /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).