$ cat a.f90 
program main
   use ISO_C_BINDING
   implicit none
   type, bind(C) :: descr
      type(C_PTR) :: address
   end type descr
   type(descr) :: DD
   double precision, target :: buf(1)

   buf = (/ 0 /)
   DD = descr(c_loc(buf))
   print *, transfer(DD%address, 0_c_intptr_t), &
     transfer(c_loc (buf), 0_c_intptr_t)
end program main

$ gfortran a.f90 && ./a.out
           0 -1073744200


-- 
           Summary: C_LOC in derived type constructor gives weird result
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fxcoudert at gcc dot gnu dot org


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

Reply via email to