From 5e4404b8084a1e087c623da575560e940a47db81 Mon Sep 17 00:00:00 2001 From: Janus Weil Date: Tue, 11 Dec 2012 00:17:43 +0100 Subject: [PATCH] re PR fortran/52909 ([F03] Procedure pointers not private to modules) 2012-12-10 Janus Weil PR fortran/52909 * trans-decl.c (get_proc_pointer_decl): Apply name mangling. 2012-12-10 Janus Weil PR fortran/52909 * gfortran.dg/proc_ptr_39.f90: New test case. From-SVN: r194375 --- gcc/fortran/ChangeLog | 5 +++++ gcc/fortran/trans-decl.c | 8 ++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/proc_ptr_39.f90 | 20 ++++++++++++++++++++ 4 files changed, 38 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/proc_ptr_39.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index aa9eb9f6de7..a0677870baa 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2012-12-10 Janus Weil + + PR fortran/52909 + * trans-decl.c (get_proc_pointer_decl): Apply name mangling. + 2012-12-09 Tobias Burnus * trans-array.c (gfc_deallocate_scalar_with_status): Use diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index b23605058d0..dbc5a10ea25 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -1531,6 +1531,14 @@ get_proc_pointer_decl (gfc_symbol *sym) VAR_DECL, get_identifier (sym->name), build_pointer_type (gfc_get_function_type (sym))); + if (sym->module) + { + /* Apply name mangling. */ + gfc_set_decl_assembler_name (decl, gfc_sym_mangled_identifier (sym)); + if (sym->attr.use_assoc) + DECL_IGNORED_P (decl) = 1; + } + if ((sym->ns->proc_name && sym->ns->proc_name->backend_decl == current_function_decl) || sym->attr.contained) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ab9459980a8..481bbaa7083 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-12-10 Janus Weil + + PR fortran/52909 + * gfortran.dg/proc_ptr_39.f90: New test case. + 2012-12-10 Richard Sandiford * gcc.target/mips/octeon-bbit-2.c: Restructure loops so that no diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_39.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_39.f90 new file mode 100644 index 00000000000..6eb0f15d407 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_39.f90 @@ -0,0 +1,20 @@ +! { dg-do compile } +! +! PR 52909: [F03] Procedure pointers not private to modules +! +! Contributed by Andrew Benson + +module Module1 + procedure(), pointer, private :: procPtr => null() +end module + +module Module2 + procedure(), pointer, private :: procPtr => null() +end module + +program Test + use Module1 + use Module2 +end program + +! { dg-final { cleanup-modules "Module1 Module2" } }