diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2010-01-14 06:13:19 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2010-01-14 06:13:19 +0000 |
commit | 08b02036337225eb9b58497c704efaa2b41918bc (patch) | |
tree | b784fe3aae3d08f0f6aa9bcc21ba10aa55db0bb6 /gcc/fortran | |
parent | 671ec5cbcf803430be2036af48e60bda961681f8 (diff) | |
download | gcc-08b02036337225eb9b58497c704efaa2b41918bc.zip gcc-08b02036337225eb9b58497c704efaa2b41918bc.tar.gz gcc-08b02036337225eb9b58497c704efaa2b41918bc.tar.bz2 |
re PR fortran/42481 (generic interface not recognized)
2010-01-14 Paul Thomas <pault@gcc.gnu.org>
PR fortran/42481
* module.c (load_generic_interfaces): If a procedure that is
use associated but not generic is given an interface that
includes itself, then make it generic.
2010-01-14 Paul Thomas <pault@gcc.gnu.org>
PR fortran/42481
* gfortran.dg/generic_19.f90 : New test.
From-SVN: r155876
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/fortran/module.c | 32 |
2 files changed, 36 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 09bfccf..be65b9a 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2010-01-14 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/42481 + * module.c (load_generic_interfaces): If a procedure that is + use associated but not generic is given an interface that + includes itself, then make it generic. + 2010-01-11 Joseph Myers <joseph@codesourcery.com> Shujing Zhao <pearly.zhao@oracle.com> diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index 140f2e2..667bab8 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -1,6 +1,7 @@ /* Handle modules, which amounts to loading and saving symbols and their attendant structures. - Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 + Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, + 2009, 2010 Free Software Foundation, Inc. Contributed by Andy Vaught @@ -3750,8 +3751,9 @@ load_generic_interfaces (void) const char *p; char name[GFC_MAX_SYMBOL_LEN + 1], module[GFC_MAX_SYMBOL_LEN + 1]; gfc_symbol *sym; - gfc_interface *generic = NULL; + gfc_interface *generic = NULL, *gen = NULL; int n, i, renamed; + bool ambiguous_set = false; mio_lparen (); @@ -3836,9 +3838,13 @@ load_generic_interfaces (void) sym = st->n.sym; if (st && !sym->attr.generic + && !st->ambiguous && sym->module && strcmp(module, sym->module)) - st->ambiguous = 1; + { + ambiguous_set = true; + st->ambiguous = 1; + } } sym->attr.use_only = only_flag; @@ -3854,6 +3860,26 @@ load_generic_interfaces (void) sym->generic = generic; sym->attr.generic_copy = 1; } + + /* If a procedure that is not generic has generic interfaces + that include itself, it is generic! We need to take care + to retain symbols ambiguous that were already so. */ + if (sym->attr.use_assoc + && !sym->attr.generic + && sym->attr.flavor == FL_PROCEDURE) + { + for (gen = generic; gen; gen = gen->next) + { + if (gen->sym == sym) + { + sym->attr.generic = 1; + if (ambiguous_set) + st->ambiguous = 0; + break; + } + } + } + } } |