diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index 82666c48bec..2ffb8cf7529 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -3056,7 +3056,16 @@ gfc_get_function_type (gfc_symbol * sym, gfc_actual_arglist *actual_args) type = build_pointer_type (type); } else - type = gfc_sym_type (arg); + { + type = gfc_sym_type (arg); + /* FIXME: There can be some fine tuning, see fine print regarding + argument handling in the Fortran standard. Check whether + CLASS is handle correctly; check whether something goes wrong + if used with asynchronous I/O or ... */ + if (!arg->attr.target && !arg->attr.pointer + && !arg->attr.asynchronous && !arg->attr.codimension) + type = build_qualified_type (type, TYPE_QUAL_RESTRICT); + } /* Parameter Passing Convention