public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/52542] New: Procedure with a Bind (C) named interface does not inherit the Bind (C)
@ 2012-03-09 11:45 mathewc at nag dot co.uk
  2012-03-09 13:31 ` [Bug fortran/52542] " burnus at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: mathewc at nag dot co.uk @ 2012-03-09 11:45 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52542
           Summary: Procedure with a Bind (C) named interface does not
                    inherit the Bind (C)
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: mathewc@nag.co.uk


$ uname -a
Linux stonehenge 3.2.9-1.fc16.x86_64 #1 SMP Thu Mar 1 01:41:10 UTC 2012 x86_64
x86_64 x86_64 GNU/Linux

$ gfortran --version
GNU Fortran (GCC) 4.8.0 20120309 (experimental) [trunk revision 185121]

$ cat bind.f90
interface
  subroutine s() bind(c)
  end subroutine s
end interface
procedure(s) :: t
call t
end

$ gfortran -c bind.f90 ; nm bind.o
0000000000000000 t MAIN__
                 U _gfortran_set_args
                 U _gfortran_set_options
000000000000000b T main
0000000000000000 r options.0.1852
                 U t_

Note: that should be 't', not 't_'.


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

* [Bug fortran/52542] Procedure with a Bind (C) named interface does not inherit the Bind (C)
  2012-03-09 11:45 [Bug fortran/52542] New: Procedure with a Bind (C) named interface does not inherit the Bind (C) mathewc at nag dot co.uk
@ 2012-03-09 13:31 ` burnus at gcc dot gnu.org
  2012-03-12  9:04 ` burnus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-03-09 13:31 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-03-09
                 CC|                            |burnus at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-03-09 13:31:19 UTC ---
Confirmed. It's an interesting issue, but fortunately clearly specified in the
standard (F2008):

C1222 (R1211) If proc-language-binding-spec is specified, the proc-interface
      shall appear, it shall be an interface-name, and interface-name shall be
      declared with a proc-language-binding-spec.

and then in 12.4.3.6p5 (normative):

"A proc-language-binding-spec without a NAME= is allowed, but is redundant with
the proc-interface required by C1222."


Untested patch:

--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -4857,2 +4857,5 @@ match_procedure_decl (void)

+  if (proc_if && proc_if->attr.is_bind_c)
+    sym->attr.is_bind_c = 1;
+
   /* Get procedure symbols.  */


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

* [Bug fortran/52542] Procedure with a Bind (C) named interface does not inherit the Bind (C)
  2012-03-09 11:45 [Bug fortran/52542] New: Procedure with a Bind (C) named interface does not inherit the Bind (C) mathewc at nag dot co.uk
  2012-03-09 13:31 ` [Bug fortran/52542] " burnus at gcc dot gnu.org
@ 2012-03-12  9:04 ` burnus at gcc dot gnu.org
  2012-03-13 17:14 ` burnus at gcc dot gnu.org
  2012-03-13 17:28 ` mathew.ian.cross at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-03-12  9:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-03-12 09:03:57 UTC ---
Author: burnus
Date: Mon Mar 12 09:03:49 2012
New Revision: 185215

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185215
Log:
2012-03-12  Tobias Burnus  <burnus@net-b.de>

        PR fortran/52542
        * decl.c (match_procedure_decl): If the interface
        is bind(C), the procedure is as well.

2012-03-12  Tobias Burnus  <burnus@net-b.de>

        PR fortran/52542
        * gfortran.dg/proc_ptr_35.f90: New.


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


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

* [Bug fortran/52542] Procedure with a Bind (C) named interface does not inherit the Bind (C)
  2012-03-09 11:45 [Bug fortran/52542] New: Procedure with a Bind (C) named interface does not inherit the Bind (C) mathewc at nag dot co.uk
  2012-03-09 13:31 ` [Bug fortran/52542] " burnus at gcc dot gnu.org
  2012-03-12  9:04 ` burnus at gcc dot gnu.org
@ 2012-03-13 17:14 ` burnus at gcc dot gnu.org
  2012-03-13 17:28 ` mathew.ian.cross at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-03-13 17:14 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

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

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-03-13 15:38:04 UTC ---
The bug has been fixed on the trunk (GCC 4.8). As it is no regression and as it
can be worked around using a "bind(C)" in the procedure line, I do not intent
to backport the bug fix.

Thanks for the bugreport!


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

* [Bug fortran/52542] Procedure with a Bind (C) named interface does not inherit the Bind (C)
  2012-03-09 11:45 [Bug fortran/52542] New: Procedure with a Bind (C) named interface does not inherit the Bind (C) mathewc at nag dot co.uk
                   ` (2 preceding siblings ...)
  2012-03-13 17:14 ` burnus at gcc dot gnu.org
@ 2012-03-13 17:28 ` mathew.ian.cross at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: mathew.ian.cross at gmail dot com @ 2012-03-13 17:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from mathew.ian.cross at gmail dot com 2012-03-13 17:26:44 UTC ---
On 13/03/12 15:38, burnus at gcc dot gnu.org wrote:
> I do not intent to backport the bug fix.

Cheers. That sounds fair enough.


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

end of thread, other threads:[~2012-03-13 17:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-09 11:45 [Bug fortran/52542] New: Procedure with a Bind (C) named interface does not inherit the Bind (C) mathewc at nag dot co.uk
2012-03-09 13:31 ` [Bug fortran/52542] " burnus at gcc dot gnu.org
2012-03-12  9:04 ` burnus at gcc dot gnu.org
2012-03-13 17:14 ` burnus at gcc dot gnu.org
2012-03-13 17:28 ` mathew.ian.cross at gmail dot com

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).