This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Error: Can't convert TYPE(c_ptr) to INTEGER(4)
- From: Andrew Benson <abenson at its dot caltech dot edu>
- To: fortran at gcc dot gnu dot org
- Date: Thu, 2 Sep 2010 11:28:09 -0700
- Subject: Error: Can't convert TYPE(c_ptr) to INTEGER(4)
After checking out the latest gfortran 4.6 updates (revision 163780) this
morning I'm getting an error that seems to be related to "c_null_ptr". I've
attached a minimal test case that shows this error.
$ gfortran -c test.F90 -o test.o
test.F90:5.30:
type(c_ptr) :: accelPtr = c_null_ptr
1
Error: Can't convert TYPE(c_ptr) to INTEGER(4) at (1)
The test case compiles OK under gfortran 4.4. The problem must have arisen
between revisions 163661 and 163780 (my code compiled and ran successfully
under 163661). Note that the presence of the "allocate" statement in the test
case is required to cause the error - commenting it out results in a
successful compile.
I'll try to locate the responsible revision unless anyone can figure out what
the problem is first!
-Andrew.
--
* Andrew Benson: http://www.tapir.caltech.edu/~abenson/contact.html
* Galacticus: http://sites.google.com/site/galacticusmodel
module filter
use, intrinsic :: iso_c_binding
type :: cType
type(c_ptr) :: accelPtr = c_null_ptr
end type cType
type filterType
type(cType) :: accel
end type filterType
type(filterType), allocatable, dimension(:) :: filters
contains
subroutine load()
allocate(filters(1))
return
end subroutine load
end module filter