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/45190] New: Compile-time error on valid code: can't convert TYPE(_gfortran_iso_c_binding_c_ptr) to TYPE(c_ptr)


> gfortran --version
GNU Fortran (GCC) 4.5.1

> uname -a
Linux tiree.nag.co.uk 2.6.27.25-170.2.72.fc10.x86_64 #1 SMP Sun Jun 21 18:39:34
EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

> cat cfpointerstress.f90
MODULE NAG_J_TYPES
  USE ISO_C_BINDING, ONLY : C_PTR
  IMPLICIT NONE
  TYPE                            :: NAG_IMAGE
     INTEGER                      :: WIDTH, HEIGHT, PXFMT, NCHAN
     TYPE (C_PTR)                 :: PIXELS
  END TYPE NAG_IMAGE
END MODULE NAG_J_TYPES
program cfpointerstress
  use nag_j_types
  use iso_c_binding
  implicit none
  type(nag_image),pointer :: img
  type(C_PTR)             :: ptr
  real, pointer           :: r
  allocate(r)
  allocate(img)
  r = 12
  ptr = c_loc(img)
  write(*,*) 'C_ASSOCIATED =', C_ASSOCIATED(ptr)
  call c_f_pointer(ptr, img)
  write(*,*) 'ASSOCIATED =', associated(img)
  deallocate(r)
end program cfpointerstress

> gfortran cfpointerstress.f90
cfpointerstress.f90:19.8:

  ptr = c_loc(img)
        1
Error: Can't convert TYPE(_gfortran_iso_c_binding_c_ptr) to TYPE(c_ptr) at (1)


-- 
           Summary: Compile-time error on valid code: can't convert
                    TYPE(_gfortran_iso_c_binding_c_ptr) to TYPE(c_ptr)
           Product: gcc
           Version: 4.5.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mathewc at nag dot co dot uk


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


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