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/50612] New: C_FUNLOC takes the wrong address (result variable not function address)


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

             Bug #: 50612
           Summary: C_FUNLOC takes the wrong address (result variable not
                    function address)
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org


Based on the discussion at
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/4df24f6197eb142a

In the following program C_FUNLOC takes the address of the result variable and
not the one of the function itself.

I have not checked whether the code is valid, but if it is, the function
address should be taken -- and if it is invalid, an error should be printed.


integer function foo() bind(C)
  use iso_c_binding
  implicit none
  type(c_funptr) :: fptr
  fptr = c_funloc(foo) !  takes address of result variable!
  foo = 42
end function foo


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