This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/32580] New: iso_c_binding c_f_procpointer


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]