aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/interface.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2009-06-22 04:41:10 +0000
committerPaul Thomas <pault@gcc.gnu.org>2009-06-22 04:41:10 +0000
commit22a0a78022d0bd05385d18ab222cd6c1c8dc29b1 (patch)
tree7ff210851d617b7d8ed2f460bd8845f78a174649 /gcc/fortran/interface.c
parent0e6640d89daa5b3e1515d84823af83f9ecb40209 (diff)
downloadgcc-22a0a78022d0bd05385d18ab222cd6c1c8dc29b1.zip
gcc-22a0a78022d0bd05385d18ab222cd6c1c8dc29b1.tar.gz
gcc-22a0a78022d0bd05385d18ab222cd6c1c8dc29b1.tar.bz2
re PR fortran/40443 (Elemental procedure in genericl interface incorrectly selected in preference to specific procedure)
2009-06-22 Paul Thomas <pault@gcc.gnu.org> PR fortran/40443 * interface.c (gfc_search_interface): Hold back a match to an elementary procedure until all other possibilities are exhausted. 2009-06-22 Paul Thomas <pault@gcc.gnu.org> PR fortran/40443 * gfortran.dg/generic_18.f90: New test. From-SVN: r148776
Diffstat (limited to 'gcc/fortran/interface.c')
-rw-r--r--gcc/fortran/interface.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 7d26fe4..53cc95f 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -2425,6 +2425,7 @@ gfc_symbol *
gfc_search_interface (gfc_interface *intr, int sub_flag,
gfc_actual_arglist **ap)
{
+ gfc_symbol *elem_sym = NULL;
for (; intr; intr = intr->next)
{
if (sub_flag && intr->sym->attr.function)
@@ -2433,10 +2434,19 @@ gfc_search_interface (gfc_interface *intr, int sub_flag,
continue;
if (gfc_arglist_matches_symbol (ap, intr->sym))
- return intr->sym;
+ {
+ /* Satisfy 12.4.4.1 such that an elemental match has lower
+ weight than a non-elemental match. */
+ if (intr->sym->attr.elemental)
+ {
+ elem_sym = intr->sym;
+ continue;
+ }
+ return intr->sym;
+ }
}
- return NULL;
+ return elem_sym ? elem_sym : NULL;
}