aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanus Weil <janus@gcc.gnu.org>2010-01-17 14:33:11 +0100
committerJanus Weil <janus@gcc.gnu.org>2010-01-17 14:33:11 +0100
commitae7c61dead40c0674b58c676a225ca05cea3ffe8 (patch)
tree8c1bf05482652f2ce135f68f615e6f5f831954e3
parent8232dc642719b5b19812bffd1ee7f40888a7d328 (diff)
downloadgcc-ae7c61dead40c0674b58c676a225ca05cea3ffe8.zip
gcc-ae7c61dead40c0674b58c676a225ca05cea3ffe8.tar.gz
gcc-ae7c61dead40c0674b58c676a225ca05cea3ffe8.tar.bz2
re PR fortran/42677 (Bogus Error: Ambiguous interfaces '...' in intrinsic assignment operator)
gcc/fortran/ 2010-01-17 Janus Weil <janus@gcc.gnu.org> PR fortran/42677 * gfortran.h (symbol_attribute): Remove 'ambiguous_interfaces'. * interface.c (check_interface1): Move a warning message here from resolve_fl_procedure. (check_sym_interfaces): Removed 'attr.ambiguous_interfaces'. * module.c (read_module): Remove call to gfc_check_interfaces, since this comes too early here. * resolve.c (resolve_fl_procedure): Move warning message to check_interface1. gcc/testsuite/ 2010-01-17 Janus Weil <janus@gcc.gnu.org> PR fortran/42677 * gfortran.dg/interface_assignment_5.f90: New test. From-SVN: r155979
-rw-r--r--gcc/fortran/ChangeLog12
-rw-r--r--gcc/fortran/gfortran.h3
-rw-r--r--gcc/fortran/interface.c20
-rw-r--r--gcc/fortran/module.c2
-rw-r--r--gcc/fortran/resolve.c4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/interface_assignment_5.f9049
7 files changed, 75 insertions, 20 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index af85555..b2741b1 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,15 @@
+2010-01-17 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/42677
+ * gfortran.h (symbol_attribute): Remove 'ambiguous_interfaces'.
+ * interface.c (check_interface1): Move a warning message here from
+ resolve_fl_procedure.
+ (check_sym_interfaces): Removed 'attr.ambiguous_interfaces'.
+ * module.c (read_module): Remove call to gfc_check_interfaces, since
+ this comes too early here.
+ * resolve.c (resolve_fl_procedure): Move warning message to
+ check_interface1.
+
2010-01-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/42684
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 345a701..320de83 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -714,9 +714,6 @@ typedef struct
modification of type or type parameters is permitted. */
unsigned referenced:1;
- /* Set if the symbol has ambiguous interfaces. */
- unsigned ambiguous_interfaces:1;
-
/* Set if this is the symbol for the main program. */
unsigned is_main_program:1;
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 2a5ece1..f27d75c 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -1132,16 +1132,16 @@ check_interface1 (gfc_interface *p, gfc_interface *q0,
NULL, 0))
{
if (referenced)
- {
- gfc_error ("Ambiguous interfaces '%s' and '%s' in %s at %L",
- p->sym->name, q->sym->name, interface_name,
- &p->where);
- }
-
- if (!p->sym->attr.use_assoc && q->sym->attr.use_assoc)
+ gfc_error ("Ambiguous interfaces '%s' and '%s' in %s at %L",
+ p->sym->name, q->sym->name, interface_name,
+ &p->where);
+ else if (!p->sym->attr.use_assoc && q->sym->attr.use_assoc)
gfc_warning ("Ambiguous interfaces '%s' and '%s' in %s at %L",
p->sym->name, q->sym->name, interface_name,
&p->where);
+ else
+ gfc_warning ("Although not referenced, '%s' has ambiguous "
+ "interfaces at %L", interface_name, &p->where);
return 1;
}
}
@@ -1157,7 +1157,6 @@ static void
check_sym_interfaces (gfc_symbol *sym)
{
char interface_name[100];
- bool k;
gfc_interface *p;
if (sym->ns != gfc_current_ns)
@@ -1184,9 +1183,8 @@ check_sym_interfaces (gfc_symbol *sym)
/* Originally, this test was applied to host interfaces too;
this is incorrect since host associated symbols, from any
source, cannot be ambiguous with local symbols. */
- k = sym->attr.referenced || !sym->attr.use_assoc;
- if (check_interface1 (sym->generic, sym->generic, 1, interface_name, k))
- sym->attr.ambiguous_interfaces = 1;
+ check_interface1 (sym->generic, sym->generic, 1, interface_name,
+ sym->attr.referenced || !sym->attr.use_assoc);
}
}
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 667bab8..13c9b82 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -4482,8 +4482,6 @@ read_module (void)
module_name);
}
- gfc_check_interfaces (gfc_current_ns);
-
/* Now we should be in a position to fill f2k_derived with derived type
extensions, since everything has been loaded. */
set_module_locus (&extensions);
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 9212521..6bc5fde 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -9077,10 +9077,6 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag)
{
gfc_formal_arglist *arg;
- if (sym->attr.ambiguous_interfaces && !sym->attr.referenced)
- gfc_warning ("Although not referenced, '%s' at %L has ambiguous "
- "interfaces", sym->name, &sym->declared_at);
-
if (sym->attr.function
&& resolve_fl_var_and_proc (sym, mp_flag) == FAILURE)
return FAILURE;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5272d3d..f92f6c5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2010-01-17 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/42677
+ * gfortran.dg/interface_assignment_5.f90: New test.
+
2010-01-17 Dodji Seketeli <dodji@redhat.com>
PR c++/42697
diff --git a/gcc/testsuite/gfortran.dg/interface_assignment_5.f90 b/gcc/testsuite/gfortran.dg/interface_assignment_5.f90
new file mode 100644
index 0000000..8444dd0
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/interface_assignment_5.f90
@@ -0,0 +1,49 @@
+! { dg-do compile }
+!
+! PR 42677: [4.5 Regression] Bogus Error: Ambiguous interfaces '...' in intrinsic assignment operator
+!
+! Contributed by Harald Anlauf <anlauf@gmx.de>
+
+module mod1
+ implicit none
+ type t_m
+ integer :: i = 0
+ end type t_m
+!------------------------------------------------------------------------------
+ interface assignment (=)
+ module procedure assign_m
+ end interface
+!------------------------------------------------------------------------------
+contains
+ subroutine assign_m (y, x)
+ type(t_m) ,intent(inout) :: y
+ type(t_m) ,intent(in) :: x
+ end subroutine assign_m
+end module mod1
+!==============================================================================
+module mod2
+ use mod1, only: t_m, assignment(=)
+ implicit none
+ type t_atm
+ integer :: k
+ end type t_atm
+!------------------------------------------------------------------------------
+ interface assignment(=)
+ module procedure assign_to_atm
+ end interface
+!------------------------------------------------------------------------------
+ interface
+ pure subroutine delete_m (x)
+ use mod1
+ type(t_m) ,intent(in) :: x
+ end subroutine delete_m
+ end interface
+!------------------------------------------------------------------------------
+contains
+ subroutine assign_to_atm (atm, r)
+ type(t_atm) ,intent(inout) :: atm
+ integer ,intent(in) :: r
+ end subroutine assign_to_atm
+end module mod2
+
+! { dg-final { cleanup-modules "mod1 mod2" } }