}
-/* Create the DECL_ARGUMENTS for a procedure. */
+/* Create the DECL_ARGUMENTS for a procedure.
+ NOTE: The arguments added here must match the argument type created by
+ gfc_get_function_type (). */
static void
create_function_arglist (gfc_symbol * sym)
DECL_ARG_TYPE (token) = TREE_VALUE (typelist);
TREE_READONLY (token) = 1;
hidden_arglist = chainon (hidden_arglist, token);
+ hidden_typelist = TREE_CHAIN (hidden_typelist);
gfc_finish_decl (token);
offset = build_decl (input_location, PARM_DECL,
DECL_ARG_TYPE (offset) = TREE_VALUE (typelist);
TREE_READONLY (offset) = 1;
hidden_arglist = chainon (hidden_arglist, offset);
+ hidden_typelist = TREE_CHAIN (hidden_typelist);
gfc_finish_decl (offset);
}
return build_type_attribute_variant (fntype, tmp);
}
+
+/* NOTE: The returned function type must match the argument list created by
+ create_function_arglist. */
+
tree
gfc_get_function_type (gfc_symbol * sym, gfc_actual_arglist *actual_args)
{
}
}
- /* Add hidden string length parameters. */
+ /* Add hidden arguments. */
for (f = gfc_sym_get_dummy_args (sym); f; f = f->next)
{
arg = f->sym;
+ /* Add hidden string length parameters. */
if (arg && arg->ts.type == BT_CHARACTER && !sym->attr.is_bind_c)
{
if (!arg->ts.deferred)
&& arg->ts.type != BT_CLASS
&& !gfc_bt_struct (arg->ts.type))
vec_safe_push (typelist, boolean_type_node);
+ /* Coarrays which are descriptorless or assumed-shape pass with
+ -fcoarray=lib the token and the offset as hidden arguments. */
+ else if (arg
+ && flag_coarray == GFC_FCOARRAY_LIB
+ && ((arg->ts.type != BT_CLASS
+ && arg->attr.codimension
+ && !arg->attr.allocatable)
+ || (arg->ts.type == BT_CLASS
+ && CLASS_DATA (arg)->attr.codimension
+ && !CLASS_DATA (arg)->attr.allocatable)))
+ {
+ vec_safe_push (typelist, pvoid_type_node); /* caf_token. */
+ vec_safe_push (typelist, gfc_array_index_type); /* caf_offset. */
+ }
}
if (!vec_safe_is_empty (typelist)