public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32580]  New: iso_c_binding c_f_procpointer
@ 2007-07-02  7:20 jv244 at cam dot ac dot uk
  2007-07-02  7:37 ` [Bug fortran/32580] " jv244 at cam dot ac dot uk
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: jv244 at cam dot ac dot uk @ 2007-07-02  7:20 UTC (permalink / raw)
  To: gcc-bugs

The following program doesn't compile & link:

---- test_f90.f90 ----
MODULE X

  USE ISO_C_BINDING
  INTERFACE
    REAL(KIND=C_FLOAT) FUNCTION mytype( a ) BIND(C)
       USE ISO_C_BINDING
       INTEGER(KIND=C_INT), VALUE :: a
    END FUNCTION
    SUBROUTINE init() BIND(C,name="init")
    END SUBROUTINE
  END INTERFACE

  TYPE(C_FUNPTR), BIND(C,name="funpointer") :: funpointer

END MODULE X

USE X
PROCEDURE(mytype), POINTER :: ptype

CALL init()
CALL C_F_PROCPOINTER(funpointer,ptype)
write(6,*) ptype(3)

END


---- test_c.c ----
float (*funpointer)(int);

float f(int t)
{
  return t*3;
}

void init()
{
 funpointer=f;
}


test as:

> gcc -c test_c.c
> g95 test_f90.f90 test_c.o
> ./a.out
 9.


-- 
           Summary: iso_c_binding c_f_procpointer
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jv244 at cam dot ac dot uk


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


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

end of thread, other threads:[~2008-07-03 13:44 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-02  7:20 [Bug fortran/32580] New: iso_c_binding c_f_procpointer jv244 at cam dot ac dot uk
2007-07-02  7:37 ` [Bug fortran/32580] " jv244 at cam dot ac dot uk
2007-07-02 14:57 ` kargl at gcc dot gnu dot org
2007-07-04 18:29 ` [Bug fortran/32580] iso_c_binding c_f_procpointer / procedure pointers burnus at gcc dot gnu dot org
2007-10-16  4:32 ` jv244 at cam dot ac dot uk
2007-10-16  6:46 ` burnus at gcc dot gnu dot org
2007-10-16  8:31 ` jv244 at cam dot ac dot uk
2007-10-16 11:26 ` burnus at gcc dot gnu dot org
2008-05-24 17:52 ` jaydub66 at gmail dot com
2008-05-25 12:14 ` jv244 at cam dot ac dot uk
2008-05-29 11:29 ` burnus at gcc dot gnu dot org
2008-06-02 15:33 ` burnus at gcc dot gnu dot org
2008-07-02 19:55 ` janus at gcc dot gnu dot org
2008-07-02 20:20 ` janus at gcc dot gnu dot org
2008-07-02 20:20 ` janus at gcc dot gnu dot org
2008-07-03 13:44 ` jv244 at cam dot ac dot uk

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