From 7ca17033382c71cbfe6cd24da017c2c333b114af Mon Sep 17 00:00:00 2001 From: Janus Weil Date: Fri, 17 Dec 2010 13:31:54 +0100 Subject: re PR fortran/46849 ([OOP] MODULE PROCEDURE resolution does not work in BLOCK or SELECT TYPE) 2010-12-17 Janus Weil Tobias Burnus PR fortran/46849 * resolve.c (resolve_symbol): Remove symbols that wrongly ended up in a local BLOCK namespace. 2010-12-17 Janus Weil PR fortran/46849 * gfortran.dg/block_9.f08: New. Co-Authored-By: Tobias Burnus From-SVN: r167978 --- gcc/fortran/ChangeLog | 7 +++++++ gcc/fortran/resolve.c | 4 +++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/block_9.f08 | 23 +++++++++++++++++++++++ 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/block_9.f08 (limited to 'gcc') diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 2c4de57..960a6e8 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2010-12-17 Janus Weil + Tobias Burnus + + PR fortran/46849 + * resolve.c (resolve_symbol): Remove symbols that wrongly ended up + in a local BLOCK namespace. + 2010-12-15 Jakub Jelinek PR fortran/46945 diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index a27fe2d..7081146 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -11784,7 +11784,9 @@ resolve_symbol (gfc_symbol *sym) for (ns = gfc_current_ns->parent; ns; ns = ns->parent) { symtree = gfc_find_symtree (ns->sym_root, sym->name); - if (symtree && symtree->n.sym->generic) + if (symtree && (symtree->n.sym->generic || + (symtree->n.sym->attr.flavor == FL_PROCEDURE + && sym->ns->construct_entities))) { this_symtree = gfc_find_symtree (gfc_current_ns->sym_root, sym->name); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8cfa5c0..e32bf6e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-12-17 Janus Weil + + PR fortran/46849 + * gfortran.dg/block_9.f08: New. + 2010-12-17 Dodji Seketeli * g++.dg/debug/dwarf2/self-ref-1.C: New test. diff --git a/gcc/testsuite/gfortran.dg/block_9.f08 b/gcc/testsuite/gfortran.dg/block_9.f08 new file mode 100644 index 0000000..277d1e2 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/block_9.f08 @@ -0,0 +1,23 @@ +! { dg-do compile } +! +! PR 46849: [OOP] MODULE PROCEDURE resolution does not work in BLOCK or SELECT TYPE +! +! Contributed by Reinhold Bader + + implicit none + + block + call init(fun) + end block + +contains + + subroutine init(func) + real, external :: func + end subroutine + + real function fun() + fun = 1.1 + end function + +end -- cgit v1.1