diff options
author | Tobias Burnus <burnus@net-b.de> | 2012-03-03 09:40:24 +0100 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2012-03-03 09:40:24 +0100 |
commit | 45a6932568c7c3f4aaf0e0c935a5f5d58ecf1919 (patch) | |
tree | 0c29d6bc5a187e73c40b9223ee82a99a407d2889 /gcc/fortran/interface.c | |
parent | c0e8830c542d211c6fe1fe3c49a814a46ffc9617 (diff) | |
download | gcc-45a6932568c7c3f4aaf0e0c935a5f5d58ecf1919.zip gcc-45a6932568c7c3f4aaf0e0c935a5f5d58ecf1919.tar.gz gcc-45a6932568c7c3f4aaf0e0c935a5f5d58ecf1919.tar.bz2 |
re PR fortran/48820 (TR 29113: Implement parts needed for MPI 3)
2012-03-03 Tobias Burnus <burnus@net-b.de>
PR fortran/48820
* decl.c (gfc_match_decl_type_spec): Support type(*).
(gfc_verify_c_interop): Allow type(*).
* dump-parse-tree.c (show_typespec): Handle type(*).
* expr.c (gfc_copy_expr): Ditto.
* interface.c (compare_type_rank, compare_parameter,
compare_actual_formal, gfc_procedure_use): Ditto.
* libgfortran.h (bt): Add BT_ASSUMED.
* misc.c (gfc_basic_typename, gfc_typename): Handle type(*).
* module.c (bt_types): Ditto.
* resolve.c (assumed_type_expr_allowed): New static variable.
(resolve_actual_arglist, resolve_variable, resolve_symbol):
Handle type(*).
* trans-expr.c (gfc_conv_procedure_call): Ditto.
* trans-types.c (gfc_typenode_for_spec, gfc_get_dtype): Ditto.
2012-03-03 Tobias Burnus <burnus@net-b.de>
PR fortran/48820
* gfortran.dg/assumed_type_1.f90: New.
* gfortran.dg/assumed_type_2.f90: New.
* gfortran.dg/assumed_type_3.f90: New.
* gfortran.dg/assumed_type_4.f90: New.
From-SVN: r184852
Diffstat (limited to 'gcc/fortran/interface.c')
-rw-r--r-- | gcc/fortran/interface.c | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index e9df662..298ae23d 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -514,7 +514,8 @@ compare_type_rank (gfc_symbol *s1, gfc_symbol *s2) if (r1 != r2) return 0; /* Ranks differ. */ - return gfc_compare_types (&s1->ts, &s2->ts); + return gfc_compare_types (&s1->ts, &s2->ts) + || s1->ts.type == BT_ASSUMED || s2->ts.type == BT_ASSUMED; } @@ -1697,6 +1698,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, if ((actual->expr_type != EXPR_NULL || actual->ts.type != BT_UNKNOWN) && actual->ts.type != BT_HOLLERITH + && formal->ts.type != BT_ASSUMED && !gfc_compare_types (&formal->ts, &actual->ts) && !(formal->ts.type == BT_DERIVED && actual->ts.type == BT_CLASS && gfc_compare_derived_types (formal->ts.u.derived, @@ -2274,6 +2276,27 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, is_elemental, where)) return 0; + /* TS 29113, 6.3p2. */ + if (f->sym->ts.type == BT_ASSUMED + && (a->expr->ts.type == BT_DERIVED + || (a->expr->ts.type == BT_CLASS && CLASS_DATA (a->expr)))) + { + gfc_namespace *f2k_derived; + + f2k_derived = a->expr->ts.type == BT_DERIVED + ? a->expr->ts.u.derived->f2k_derived + : CLASS_DATA (a->expr)->ts.u.derived->f2k_derived; + + if (f2k_derived + && (f2k_derived->finalizers || f2k_derived->tb_sym_root)) + { + gfc_error ("Actual argument at %L to assumed-type dummy is of " + "derived type with type-bound or FINAL procedures", + &a->expr->where); + return FAILURE; + } + } + /* Special case for character arguments. For allocatable, pointer and assumed-shape dummies, the string length needs to match exactly. */ @@ -2885,7 +2908,6 @@ check_intents (gfc_formal_arglist *f, gfc_actual_arglist *a) void gfc_procedure_use (gfc_symbol *sym, gfc_actual_arglist **ap, locus *where) { - /* Warn about calls with an implicit interface. Special case for calling a ISO_C_BINDING becase c_loc and c_funloc are pseudo-unknown. Additionally, warn about procedures not @@ -2938,6 +2960,16 @@ gfc_procedure_use (gfc_symbol *sym, gfc_actual_arglist **ap, locus *where) break; } + /* TS 29113, 6.2. */ + if (a->expr && a->expr->ts.type == BT_ASSUMED + && sym->intmod_sym_id != ISOCBINDING_LOC) + { + gfc_error ("Assumed-type argument %s at %L requires an explicit " + "interface", a->expr->symtree->n.sym->name, + &a->expr->where); + break; + } + /* F2008, C1303 and C1304. */ if (a->expr && (a->expr->ts.type == BT_DERIVED || a->expr->ts.type == BT_CLASS) |