public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/34187]  New: BIND(C): Public generic with private bind(c) specific does not use bind(C) name
@ 2007-11-22 11:12 burnus at gcc dot gnu dot org
  2007-11-22 11:57 ` [Bug fortran/34187] " burnus at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-11-22 11:12 UTC (permalink / raw)
  To: gcc-bugs

As reported by Chris:
For the following code, the bind(C) is ignored when calling the private
specific subroutine "test" via calling the generic procedure "gen".
Result: The procedure "test_" is called and the linker complains.

If one makes "test" public, it works. As -fdump-parse-tree shows (after
applying the fixes from PR34186), in "main" "test" has the "bind(c)" attribute.

subroutine test() bind(c)
end subroutine test

module mod
  private
  public :: gen
  interface gen
     subroutine test() bind(c)
     end subroutine test
  end interface gen
end module mod

program main
  use mod
  call gen
end program main


-- 
           Summary: BIND(C): Public generic with private bind(c) specific
                    does not use bind(C) name
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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


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

* [Bug fortran/34187] BIND(C): Public generic with private bind(c) specific does not use bind(C) name
  2007-11-22 11:12 [Bug fortran/34187] New: BIND(C): Public generic with private bind(c) specific does not use bind(C) name burnus at gcc dot gnu dot org
@ 2007-11-22 11:57 ` burnus at gcc dot gnu dot org
  2007-11-22 19:03 ` patchapp at dberlin dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-11-22 11:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2007-11-22 11:56 -------
Some more debugging. The problem is that in gfc_conv_function_call /
gfc_sym_mangled_function_id of "main", is_bind_c=1 but binding_label = '\0'.

Actually, already for gfc_search_interface, I get sym=test and bind= '\0'.

Educated guess: The problem is in module.c; the binding label is properly
written into the .mod file (from looking at it) but in load_generic_interfaces,
the "gfc_get_symbol (p, NULL, &sym);" returns for p = "test" no binding name.


-- 


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


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

* [Bug fortran/34187] BIND(C): Public generic with private bind(c) specific does not use bind(C) name
  2007-11-22 11:12 [Bug fortran/34187] New: BIND(C): Public generic with private bind(c) specific does not use bind(C) name burnus at gcc dot gnu dot org
  2007-11-22 11:57 ` [Bug fortran/34187] " burnus at gcc dot gnu dot org
@ 2007-11-22 19:03 ` patchapp at dberlin dot org
  2007-11-24  0:11 ` burnus at gcc dot gnu dot org
  2007-11-24  0:13 ` burnus at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: patchapp at dberlin dot org @ 2007-11-22 19:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from patchapp at dberlin dot org  2007-11-22 19:03 -------
Subject: Bug number PR34187

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-11/msg01165.html


-- 


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


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

* [Bug fortran/34187] BIND(C): Public generic with private bind(c) specific does not use bind(C) name
  2007-11-22 11:12 [Bug fortran/34187] New: BIND(C): Public generic with private bind(c) specific does not use bind(C) name burnus at gcc dot gnu dot org
  2007-11-22 11:57 ` [Bug fortran/34187] " burnus at gcc dot gnu dot org
  2007-11-22 19:03 ` patchapp at dberlin dot org
@ 2007-11-24  0:11 ` burnus at gcc dot gnu dot org
  2007-11-24  0:13 ` burnus at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-11-24  0:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2007-11-24 00:11 -------
Subject: Bug 34187

Author: burnus
Date: Sat Nov 24 00:11:38 2007
New Revision: 130386

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130386
Log:
2007-11-23  Tobias Burnus  <burnus@net-b.de>

        PR fortran/34187
        * module.c (load_needed): Ensure binding_label is not lost.

        * decl.c (set_binding_label,gfc_match_bind_c): Replace
        strncpy by strcpy.

2007-11-23  Tobias Burnus  <burnus@net-b.de>

        PR fortran/34187
        * gfortran.dg/bind_c_usage_15.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/bind_c_usage_15.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/decl.c
    trunk/gcc/fortran/module.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/34187] BIND(C): Public generic with private bind(c) specific does not use bind(C) name
  2007-11-22 11:12 [Bug fortran/34187] New: BIND(C): Public generic with private bind(c) specific does not use bind(C) name burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-11-24  0:11 ` burnus at gcc dot gnu dot org
@ 2007-11-24  0:13 ` burnus at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-11-24  0:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from burnus at gcc dot gnu dot org  2007-11-24 00:13 -------
FIXED on the trunk (4.3.0). Does not affect earlier versions of gfortran.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.0


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


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

end of thread, other threads:[~2007-11-24  0:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-22 11:12 [Bug fortran/34187] New: BIND(C): Public generic with private bind(c) specific does not use bind(C) name burnus at gcc dot gnu dot org
2007-11-22 11:57 ` [Bug fortran/34187] " burnus at gcc dot gnu dot org
2007-11-22 19:03 ` patchapp at dberlin dot org
2007-11-24  0:11 ` burnus at gcc dot gnu dot org
2007-11-24  0:13 ` burnus at gcc dot gnu dot 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).