Commit 79b1d36c by Paul Thomas

re PR fortran/38594 (module function name mangled improperly if contained…

re PR fortran/38594 (module function name mangled improperly if contained function of same name exists)

2009-01-03  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/38594
	* resolve.c (resolve_call): When searching for proper host
	association, use symtree rather than symbol.  For everything
	except generic subroutines, substitute the symtree in the call
	rather than the symbol.

2009-01-03  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/38594
	* gfortran.dg/host_assoc_call_3.f90: Make sure that the generic
	interface still works, in addition to original tests.
	* gfortran.dg/host_assoc_call_6.f90: New test.

From-SVN: r143032
parent 493aa551
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -2944,15 +2944,20 @@ resolve_call (gfc_code *c) ...@@ -2944,15 +2944,20 @@ resolve_call (gfc_code *c)
if (csym && gfc_current_ns->parent && csym->ns != gfc_current_ns) if (csym && gfc_current_ns->parent && csym->ns != gfc_current_ns)
{ {
gfc_find_symbol (csym->name, gfc_current_ns, 1, &sym); gfc_symtree *st;
gfc_find_sym_tree (csym->name, gfc_current_ns, 1, &st);
sym = st ? st->n.sym : NULL;
if (sym && csym != sym if (sym && csym != sym
&& sym->ns == gfc_current_ns && sym->ns == gfc_current_ns
&& sym->attr.flavor == FL_PROCEDURE && sym->attr.flavor == FL_PROCEDURE
&& sym->attr.contained) && sym->attr.contained)
{ {
sym->refs++; sym->refs++;
csym = sym; if (csym->attr.generic)
c->symtree->n.sym = sym; c->symtree->n.sym = sym;
else
c->symtree = st;
csym = c->symtree->n.sym;
} }
} }
......
2009-01-03 Paul Thomas <pault@gcc.gnu.org>
PR fortran/38594
* gfortran.dg/host_assoc_call_3.f90: Make sure that the generic
interface still works, in addition to original tests.
* gfortran.dg/host_assoc_call_6.f90: New test.
2009-01-03 Jakub Jelinek <jakub@redhat.com> 2009-01-03 Jakub Jelinek <jakub@redhat.com>
PR c++/38705 PR c++/38705
......
...@@ -11,8 +11,10 @@ MODULE M1 ...@@ -11,8 +11,10 @@ MODULE M1
END INTERFACE END INTERFACE
CONTAINS CONTAINS
SUBROUTINE S1(I) SUBROUTINE S1(I)
i = 3
END SUBROUTINE END SUBROUTINE
SUBROUTINE S2(F) SUBROUTINE S2(F)
f = 4.0
END SUBROUTINE END SUBROUTINE
END MODULE END MODULE
...@@ -36,9 +38,18 @@ CONTAINS ...@@ -36,9 +38,18 @@ CONTAINS
end if end if
END SUBROUTINE END SUBROUTINE
END SUBROUTINE END SUBROUTINE
subroutine S4
integer :: check = 0
REAL :: rcheck = 0.0
call putaline(check)
if (check .ne. 3) call abort
call putaline(rcheck)
if (rcheck .ne. 4.0) call abort
end subroutine s4
END MODULE END MODULE
USE M2 USE M2
CALL S3 CALL S3
call S4
END END
! { dg-final { cleanup-modules "M1 M2" } } ! { dg-final { cleanup-modules "M1 M2" } }
! { dg-do compile }
!
! PR fortran/38594, in which the symtree for the first
! 'g' was being attached to the second. This is necessary
! for generic interfaces(eg. hosts_call_3.f90) but makes
! a mess otherwise.
!
! Contributed by Daniel Franke <dfranke@gcc.gnu.org>
!
MODULE m
CONTAINS
SUBROUTINE g()
END SUBROUTINE
SUBROUTINE f()
CALL g()
CONTAINS
SUBROUTINE g()
END SUBROUTINE
END SUBROUTINE
END MODULE
USE m
CALL g()
END
! { dg-final { cleanup-modules "m" } }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment