REAL(c_double) matches "double" and is OK. However, COMPLEX(c_double) is invalid as the proper kind parameter is c_double_complex matching "double _Complex"
Internally, both yield the same value and also sizeof(0.0_c_double) and sizeof(real(cmplx(0.0, c_double_cmpl)) is the same. Thus one could simply accept c_double as synonym for c_double_complex. gfortran, however, has checks build in which ensure the right KIND is used; there is room for improvement however: ! ------------------------------ use iso_c_binding implicit none real(c_double) :: r complex(c_double) :: c ! << Wrong type(c_ptr) :: ptr ptr = c_loc(c) ! <<< ERROR here end ! ------------------------------ Error: C kind parameter is for type REAL but symbol 'c' at (1) is of type COMPLEX Expected: The error is printed in the "COMPLEX(c_double)" line and not in the "c_loc" line. The other question is whether a WARNING is enough or whether one wants to have an ERROR. PS: Found at http://www.lrz-muenchen.de/services/software/mathematik/gsl/fortran/README " - gfortran 4.3.x does not support complex(c_double)." -- Summary: Bind(C) diagnostic when using c_double for COMPLEX variables Product: gcc Version: 4.4.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: burnus at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37937