diff options
author | pault <pault@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-01-17 17:33:35 +0000 |
---|---|---|
committer | pault <pault@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-01-17 17:33:35 +0000 |
commit | cdc165b9e5fbb885a1129671a6c77bcb5f0f6be6 (patch) | |
tree | 645ca4be34c9123444441514fc00fbc40f0f5d07 /gcc | |
parent | 760960a544d20804497eb85def4145fe3c28f497 (diff) | |
download | gcc-cdc165b9e5fbb885a1129671a6c77bcb5f0f6be6.tar.gz |
2007-01-17 Paul Thomas <pault@gcc.gnu.org>
PR fortran/30476
* module.c (load_generic_interfaces): Make the marking of the
symbol as ambiguous conditional on the module names being
different.
(write_generic): Ensure that the generic interface has a
non-NULL module field.
2007-01-17 Paul Thomas <pault@gcc.gnu.org>
PR fortran/30476
* gfortran.dg/generic_12.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120860 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/fortran/module.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/generic_12.f90 | 32 |
4 files changed, 53 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index cba3de897de..9dcead3472e 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,12 @@ +2007-01-17 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/30476 + * module.c (load_generic_interfaces): Make the marking of the + symbol as ambiguous conditional on the module names being + different. + (write_generic): Ensure that the generic interface has a + non-NULL module field. + 2007-01-16 Roger Sayle <roger@eyesopen.com> PR fortran/30404 diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index 05056a5cb44..1613a740046 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -3097,9 +3097,11 @@ load_generic_interfaces (void) gfc_symtree *st; p = p ? p : name; st = gfc_find_symtree (gfc_current_ns->sym_root, p); - st->ambiguous = sym->attr.generic ? 0 : 1; + if (!sym->attr.generic + && sym->module != NULL + && strcmp(module, sym->module) != 0) + st->ambiguous = 1; } - if (i == 1) { mio_interface_rest (&sym->generic); @@ -3748,6 +3750,9 @@ write_generic (gfc_symbol * sym) || !gfc_check_access (sym->attr.access, sym->ns->default_access)) return; + if (sym->module == NULL) + sym->module = gfc_get_string (module_name); + mio_symbol_interface (&sym->name, &sym->module, &sym->generic); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b8072de9a7a..e5724aee216 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-01-17 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/30476 + * gfortran.dg/generic_12.f90: New test. + 2007-01-17 Dorit Nuzman <dorit@il.ibm.com> * gcc.target/i386/vectorize1.c: Add cleanup-tree-dump. diff --git a/gcc/testsuite/gfortran.dg/generic_12.f90 b/gcc/testsuite/gfortran.dg/generic_12.f90 new file mode 100644 index 00000000000..59c3c96e3e2 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/generic_12.f90 @@ -0,0 +1,32 @@ +! { dg-do compile } +! Test the fix for PR30476 in which the generic interface hello +! was found incorrectly to be ambiguous. +! +!Contributed by Tobias Burnus <burnus@gcc.gnu.org> +! +SUBROUTINE hello_x(dum) + IMPLICIT NONE + INTEGER :: dum + WRITE(0,*) "Hello world: ", dum +END SUBROUTINE hello_x + +MODULE interfaces +IMPLICIT NONE +INTERFACE hello + SUBROUTINE hello_x(dum) + IMPLICIT NONE + INTEGER :: dum + END SUBROUTINE hello_x +END INTERFACE +END MODULE interfaces + +MODULE global_module + USE interfaces +END MODULE global_module + +PROGRAM main + USE global_module + IMPLICIT NONE + CALL hello(10) +END PROGRAM main +! { dg-final { cleanup-modules "interfaces global_module" } } |