C:\gfortran\clf\opengl3>type bug1a.f90
module m1
use ISO_C_BINDING
implicit none
private
type(C_PTR),parameter :: a = &
transfer(1_C_INTPTR_T,C_NULL_PTR)
end module m1
C:\gfortran\clf\opengl3>gfortran -c bug1a.f90
bug1a.f90:5.31:
type(C_PTR),parameter :: a = &
1
Error: Components of structure constructor 'c_ptr' at (1) are PRIVATE
So one thing to try is a cast to an array:
C:\gfortran\clf\opengl3>type bug1b.f90
module m1
use ISO_C_BINDING
implicit none
private
type(C_PTR),parameter :: a(1) = &
transfer(1_C_INTPTR_T,[type(C_PTR) :: ])
end module m1
C:\gfortran\clf\opengl3>gfortran -c bug1b.f90
f951.exe: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Since that doesn't help, perhaps we could hide the offending
intrinsic type inside a derived type:
C:\gfortran\clf\opengl3>type bug1c.f90
module m1
use ISO_C_BINDING
implicit none
private
type T
type(C_PTR) key
end type T
type(T), parameter :: b = T(key=C_NULL_PTR)
type(T),parameter :: a = transfer(1_C_INTPTR_T,b)
end module m1
C:\gfortran\clf\opengl3>gfortran -c bug1c.f90
bug1c.f90:8.35:
type(T), parameter :: b = T(key=C_NULL_PTR)
1
Error: Can't convert TYPE(c_ptr) to INTEGER(8) at (1)
Can't make sense out of that, but what if we had a zero-length array
of the derived type?
C:\gfortran\clf\opengl3>type bug1d.f90
module m1
use ISO_C_BINDING
implicit none
private
type T
type(C_PTR) key
end type T
type(T), parameter :: b(0) = [type(T) :: ]
type(T),parameter :: a(1) = transfer(1_C_INTPTR_T,b)
end module m1
C:\gfortran\clf\opengl3>gfortran -c bug1d.f90
f951.exe: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
So I am at a loss for a workaround for this issue.
--
write(*,*) transfer((/17.392111325966148d0,6.5794487871554595D-85, &
6.0134700243160014d-154/),(/'x'/)); end