diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2006-03-19 10:36:09 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2006-03-19 10:36:09 +0000 |
commit | 98cb5a5439fa61ed6d27630f617514d209c7a36a (patch) | |
tree | b16dca5ec532707c455566c5c970430026e1f61d /gcc/fortran | |
parent | 4d58f908f91b068c2a7fe2b0c6e84eed2990c2e0 (diff) | |
download | gcc-98cb5a5439fa61ed6d27630f617514d209c7a36a.zip gcc-98cb5a5439fa61ed6d27630f617514d209c7a36a.tar.gz gcc-98cb5a5439fa61ed6d27630f617514d209c7a36a.tar.bz2 |
re PR fortran/26716 (gfortran: incorrect choice of overloaded function)
2006-03-19 Paul Thomas <pault@gcc.gnu.org>
PR fortran/26716
*expr.c (external_spec_function): Permit elemental functions.
PR fortran/26716
*interface.c (compare_actual_formal): Detect call for procedure
usage and require rank checking, in this case, for assumed shape
and deferred shape arrays.
(gfc_procedure_use): Revert to pre-PR25070 call to
compare_actual_formal that does not require rank checking..
2006-03-19 Paul Thomas <pault@gcc.gnu.org>
PR fortran/26716
* gfortran.dg/elemental_initializer_1.f90: New test.
PR fortran/26716
* gfortran.dg/assumed_shape_ranks_2: New test.
From-SVN: r112210
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/fortran/expr.c | 2 | ||||
-rw-r--r-- | gcc/fortran/interface.c | 17 |
3 files changed, 22 insertions, 9 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 61bbcfd..e56a6e7 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,15 @@ +2006-03-19 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/26716 + *expr.c (external_spec_function): Permit elemental functions. + + PR fortran/26716 + *interface.c (compare_actual_formal): Detect call for procedure + usage and require rank checking, in this case, for assumed shape + and deferred shape arrays. + (gfc_procedure_use): Revert to pre-PR25070 call to + compare_actual_formal that does not require rank checking.. + 2006-03-16 Roger Sayle <roger@eyesopen.com> * gfortran.h (gfc_equiv_info): Add length field. diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 6db1c6b..8362f53 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -1636,7 +1636,7 @@ external_spec_function (gfc_expr * e) return FAILURE; } - if (!f->attr.pure) + if (!f->attr.pure && !f->attr.elemental) { gfc_error ("Specification function '%s' at %L must be PURE", f->name, &e->where); diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index f4e522a..060da05 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -1178,6 +1178,7 @@ compare_actual_formal (gfc_actual_arglist ** ap, gfc_actual_arglist **new, *a, *actual, temp; gfc_formal_arglist *f; int i, n, na; + bool rank_check; actual = *ap; @@ -1260,11 +1261,14 @@ compare_actual_formal (gfc_actual_arglist ** ap, return 0; } + rank_check = where != NULL + && !is_elemental + && f->sym->as + && (f->sym->as->type == AS_ASSUMED_SHAPE + || f->sym->as->type == AS_DEFERRED); + if (!compare_parameter - (f->sym, a->expr, - ranks_must_agree && f->sym->as - && f->sym->as->type == AS_ASSUMED_SHAPE, - is_elemental)) + (f->sym, a->expr, ranks_must_agree || rank_check, is_elemental)) { if (where) gfc_error ("Type/rank mismatch in argument '%s' at %L", @@ -1595,9 +1599,6 @@ check_intents (gfc_formal_arglist * f, gfc_actual_arglist * a) void gfc_procedure_use (gfc_symbol * sym, gfc_actual_arglist ** ap, locus * where) { - int ranks_must_agree; - ranks_must_agree = !sym->attr.elemental && (sym->attr.contained - || sym->attr.if_source == IFSRC_IFBODY); /* Warn about calls with an implicit interface. */ if (gfc_option.warn_implicit_interface @@ -1606,7 +1607,7 @@ gfc_procedure_use (gfc_symbol * sym, gfc_actual_arglist ** ap, locus * where) sym->name, where); if (sym->attr.if_source == IFSRC_UNKNOWN - || !compare_actual_formal (ap, sym->formal, ranks_must_agree, + || !compare_actual_formal (ap, sym->formal, 0, sym->attr.elemental, where)) return; |