This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/50612] New: C_FUNLOC takes the wrong address (result variable not function address)
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 04 Oct 2011 13:14:16 +0000
- Subject: [Bug fortran/50612] New: C_FUNLOC takes the wrong address (result variable not function address)
- Auto-submitted: auto-generated
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