public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/52909] New: Procedure pointers not private to modules
@ 2012-04-08 23:13 abenson at caltech dot edu
  2012-04-08 23:36 ` [Bug fortran/52909] [F03] " janus at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: abenson at caltech dot edu @ 2012-04-08 23:13 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52909

             Bug #: 52909
           Summary: Procedure pointers not private to modules
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: abenson@caltech.edu


The following code won't compile with the latest gfortran (or with 4.6 and
4.7). The two procedure pointers should be private to their respective modules
so there should be no symbol conflict.

module Module1
  implicit none
  private
  procedure(), pointer :: procPtr => null()
end module Module1

module Module2
  implicit none
  private
  procedure(), pointer :: procPtr => null()
end module Module2

program Test
  use Module1
  use Module2
  implicit none
end program Test


$ gfortran -v
Using built-in specs.
COLLECT_GCC=/home/abenson/gcc4.7/bin/gfortran
COLLECT_LTO_WRAPPER=/home/abenson/gcc4.7/libexec/gcc/x86_64-unknown-linux-
gnu/4.8.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc4.7/configure --prefix=/home/abenson/gcc4.7 --enable-
languages=c,c++,fortran --disable-multilib --with-gmp=/home/abenson/gcc4.7 --
with-mpc=/home/abenson/gcc4.7 --with-mpfr=/home/abenson/gcc4.7
Thread model: posix
gcc version 4.8.0 20120407 (experimental) (GCC) 

$ gfortran test.F90
/tmp/ccuQNbu2.s: Assembler messages:
/tmp/ccuQNbu2.s:13: Error: symbol `procptr' is already defined


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/52909] [F03] Procedure pointers not private to modules
  2012-04-08 23:13 [Bug fortran/52909] New: Procedure pointers not private to modules abenson at caltech dot edu
@ 2012-04-08 23:36 ` janus at gcc dot gnu.org
  2012-04-09 14:40 ` janus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: janus at gcc dot gnu.org @ 2012-04-08 23:36 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52909

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-04-08
                 CC|                            |janus at gcc dot gnu.org
            Summary|Procedure pointers not      |[F03] Procedure pointers
                   |private to modules          |not private to modules
     Ever Confirmed|0                           |1

--- Comment #1 from janus at gcc dot gnu.org 2012-04-08 23:36:20 UTC ---
Confirmed.

The problem is: We currently fail to apply the proper name mangling to
procedure pointers!


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/52909] [F03] Procedure pointers not private to modules
  2012-04-08 23:13 [Bug fortran/52909] New: Procedure pointers not private to modules abenson at caltech dot edu
  2012-04-08 23:36 ` [Bug fortran/52909] [F03] " janus at gcc dot gnu.org
@ 2012-04-09 14:40 ` janus at gcc dot gnu.org
  2012-12-10 23:18 ` janus at gcc dot gnu.org
  2012-12-10 23:21 ` janus at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: janus at gcc dot gnu.org @ 2012-04-09 14:40 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52909

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |janus at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #2 from janus at gcc dot gnu.org 2012-04-09 14:40:12 UTC ---
Preliminary patch, which makes the test case work:


Index: gcc/fortran/trans-decl.c
===================================================================
--- gcc/fortran/trans-decl.c    (revision 186243)
+++ gcc/fortran/trans-decl.c    (working copy)
@@ -1536,6 +1536,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)
+    {
+      /* Do 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)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/52909] [F03] Procedure pointers not private to modules
  2012-04-08 23:13 [Bug fortran/52909] New: Procedure pointers not private to modules abenson at caltech dot edu
  2012-04-08 23:36 ` [Bug fortran/52909] [F03] " janus at gcc dot gnu.org
  2012-04-09 14:40 ` janus at gcc dot gnu.org
@ 2012-12-10 23:18 ` janus at gcc dot gnu.org
  2012-12-10 23:21 ` janus at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: janus at gcc dot gnu.org @ 2012-12-10 23:18 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52909

--- Comment #3 from janus at gcc dot gnu.org 2012-12-10 23:17:51 UTC ---
Author: janus
Date: Mon Dec 10 23:17:43 2012
New Revision: 194375

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194375
Log:
2012-12-10  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/52909
    * trans-decl.c (get_proc_pointer_decl): Apply name mangling.


2012-12-10  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/52909
    * gfortran.dg/proc_ptr_39.f90: New test case.

Added:
    trunk/gcc/testsuite/gfortran.dg/proc_ptr_39.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-decl.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/52909] [F03] Procedure pointers not private to modules
  2012-04-08 23:13 [Bug fortran/52909] New: Procedure pointers not private to modules abenson at caltech dot edu
                   ` (2 preceding siblings ...)
  2012-12-10 23:18 ` janus at gcc dot gnu.org
@ 2012-12-10 23:21 ` janus at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: janus at gcc dot gnu.org @ 2012-12-10 23:21 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52909

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #4 from janus at gcc dot gnu.org 2012-12-10 23:21:30 UTC ---
Fixed with r194375. Closing.

Thanks for the report!


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-12-10 23:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-08 23:13 [Bug fortran/52909] New: Procedure pointers not private to modules abenson at caltech dot edu
2012-04-08 23:36 ` [Bug fortran/52909] [F03] " janus at gcc dot gnu.org
2012-04-09 14:40 ` janus at gcc dot gnu.org
2012-12-10 23:18 ` janus at gcc dot gnu.org
2012-12-10 23:21 ` janus at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).