]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
fortran: Delete redundant missing_arg_type field
authorMikael Morin <mikael@gcc.gnu.org>
Sun, 7 Nov 2021 13:40:24 +0000 (14:40 +0100)
committerMikael Morin <mikael@gcc.gnu.org>
Tue, 16 Nov 2021 18:07:50 +0000 (19:07 +0100)
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.

gcc/fortran/gfortran.h
gcc/fortran/interface.c
gcc/fortran/intrinsic.c
gcc/fortran/trans-expr.c

index 4230b5ae2dcc14cb34fcaf11387c62559c3f0c69..bf6177058272b1adb86f817538942b0e9957b3fa 100644 (file)
@@ -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;
index 9194fe745edd7154e6d5c3b595d4e933d5358445..12574f8f037158cdb835b8045e8ff3aa5b7c7313 100644 (file)
@@ -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;
 }
 
index cb07326ef62b41918189240c5726a4d900516f31..3682f9ae21f2a462d62b7500a775ac0c07f1fb8d 100644 (file)
@@ -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);
 
index e7aec3845d3db3ddaf0eedbeee9a6c3b4ef826be..bc502c0f43c668b50ab535dd161586b369a337e4 100644 (file)
@@ -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